Home » Interview Q & A » Q10. What is meant by the error ‘String or binary data would be truncated. The statement has been terminated’?

Q10. What is meant by the error ‘String or binary data would be truncated. The statement has been terminated’?

Our Categories

Blog Stats

  • 40,773 hits

Calendar

June 2013
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930

Please visit SQLVERSITY.COM for more details.

This is the common error in SQL Server when we are inserting or updating the data. When you are get this error for the first time, you will not be in a position to understand what it is 🙂

You get this error when you are trying to INSERT or UPDATE the data, whose length is more than the length of the column which you have defined in the table.

Ex:

Let us say, the DepartmentName column in Department table is defined as Varchar(5). But you are trying to INSERT ‘ABCDEFG’ value into DepartmentName column.

You will get this error since you are trying to INSERT a value whose length is 7 characters into the column which was defined as Varchar(5).

To resolve this error, reduce the length of the value which you are inserting or ALTER the table to increase the size of the DepartmentName column.


Leave a comment