How to fix “String or binary data would be truncated” in 5mins?
string or binary data would be truncated

How to fix “String or binary data would be truncated” in 5mins?

Save your Friend by sharing

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.

Error:
String or binary data would be truncated

Cause:
Size of the assigned data type is not enough

Example:

Database Structure:

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

Example:

Before

After

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.

This Post Has 2 Comments

  1. Dane

    Thank u for helping to solve the problem

  2. TRIMNAL3999

    Thank you!!1

Leave a Reply