String or binary data would be truncated

  • Hi,

    I am importing / Inserting data from working table to final table.

    Working table's all column has nvarchar type and in final table data type in some field has changed according to requierment as numeric(10,0) and datetime type in som fields.

    When try to import data through Insert query

    as

    INSERT INTO [tblname]

    (

    no. of fields

    )

    select

    (

    no of field with type casting used on requierd fields

    )

    but after that its giving error as

    Msg 8152, Level 16, State 13, Line 1

    String or binary data would be truncated.

    The statement has been terminated.

    Plz help as soon as possible.

    Regards

    Abhishek

  • Typically this is an issue with the data not fitting into the space in the database field.

    Meaning you have 25 characters in your input file and 20 characters in the table field.

  • The beautiful thing about this message is it does not tell you what column is having the trucation issue.

    so you have to compare datatypes and sizes of source and destination columns to find which one is too small in the destination table. you will either have to make the table bigger, or use a substring to make the source value to fit.

  • Yep, it's not a great message. I've spent too much time tracking it down.

    submit this on Connect as a suggested enhancement.

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

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