Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Vetrivel 1 post 71 karma points
    Dec 11, 2020 @ 07:04

    String or binary data would be truncated

    Hi Team,

    We are facing an SQL error with saving property values in Umbraco v7.15.6.

    We checked with the database, the values try to save in dbo.cmsPropertyData under dataNvarchar property. the property set as nvarchar(500) , that's the issue, once the input valued limit exceeds 500 it will throw the error.

    We can directly update the field datatype in SQL direct query, but we are not preferred that, is there any other ways to handle this, or

    Is this issue fixed in some other Upgraded Umbraco versions, If so we need the upgraded Umbraco version name details?

        [API] Exception was thrown in class 'SqlConnection' while invoking method 'OnError', with the message: 'String or binary data would be truncated.
    The statement has been terminated.'.
    System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
    The statement has been terminated.
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
  • Tom 3 posts 73 karma points
    21 days ago

    Hey, not sure if you're still working on this, but I ran in to a similar issue on 8.12. I was bumping up against that nvarchar(512) limit, but only occasionally and only by a relatively slim margin. I noticed that the JSON object was being stored with whitespace I didn't need, so I stripped that out by stringifying my object when it was submitting instead of submitting just the rendermodel.

    I went from this:

    $scope.$on('formSubmitting', function() {
        $scope.model.value = $scope.renderModel;

    to this:

    $scope.$on('formSubmitting', function() {
        $scope.model.value = JSON.stringify($scope.renderModel);

    Your mileage may vary depending on what your object looks like, but in my case the built-in minification from JSON.stringify() was enough to solve my problem.

  • Mark Drake 79 posts 293 karma points c-trib
    21 days ago
    Mark Drake

    I've ran into this when defining a custom data type and the valueType is set to STRING.

    The fix was to set this value to TEXT. When I made this update, the value was stored as ntext and had plenty more than 500 characters.

    Documentation for this here.

  • Tom 3 posts 73 karma points
    20 days ago

    Good to know, thanks for pointing that out!

    Is there any concern with existing data when that type is changed to text? I had considered that approach, but was worried about unforeseen consequences.

Please Sign in or register to post replies

Write your reply to: