This article focuses on analyzing and solving the SQL error “String or binary data would be truncated”. The following section of the article will introduce the cause and solution for the error.
String or binary data would be truncated
Size of the assigned data type is not enough
Imagine that someone is going to insert or update a value(text/string) to the “Name” field/column, where the length(number of characters including spaces) of the text/string value is longer than 10.
T-SQL Insert Statement
As you can see in the image above, the user is trying to insert 17 characters including space. But the maximum number of characters that can be inserted into the “Name” field is 10. Then the famous error will occur..!
Solution: Increase the size of datatype
Finally, as you can see above, simply change the size of data type to sufficient value that will enough for values that you are going to store in the particular column(field).
Thank you for visiting our web site. Hope you guys got a solution to the problem. If you have any questions regarding the error, please comment below and we’ll reply ASAP.