Issue with description text

  • When will most of the time this error comes?
    'String or binary data would be truncated'

  • mcfarlandparkway - Tuesday, February 28, 2017 3:41 PM

    When will most of the time this error comes?
    'String or binary data would be truncated'

    Usually when a column size is to small for the length of a string. Like inserting "abcdefghi" into a column defined as varchar(2).

    Sue

  • But source and destination table has both same sizes..
    nvarchar(1000).

    I checked the len of the text  - totalsize is 271 including with spaces,comma and hifens.

    Before Inserting data form source to destination we are checking-- Select   SUBSTRING(@text,1,CHARINDEX(@text,1)-1),

    When I executed this statement i have received error -  invalid length passed to the substring
    Immediately it entered into catch block and captured the error.

  • mcfarlandparkway - Tuesday, February 28, 2017 4:15 PM

    But source and destination table has both same sizes..
    nvarchar(1000).

    I checked the len of the text  - totalsize is 271 including with spaces,comma and hifens.

    Before Inserting data form source to destination we are checking-- Select   SUBSTRING(@text,1,CHARINDEX(@text,1)-1),

    When I executed this statement i have received error -  invalid length passed to the substring
    Immediately it entered into catch block and captured the error.

    You need to check your string functions. You're searching 1 for the value of @text. 
    From BOL: CHARINDEX ( expressionToFind , expressionToSearch [ , start_location ] )

    Sue

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply