While
inserting or updating data into SQL table one may get exception like “String or binary
data would be truncated. The statement has been terminated.”
Reason:
This
exception occurs when length of your DB column data type is less as compared to
value entered by user.
For example:
You have one Email field with data
type as Nvarchar(20) in Employee
table, and user try to enter testuseremail@testemail.com
in this email field, if you see email entered by user is of 27 characters which
exceeds DB column value and user will get this error.
Solution:
To solve
this error change the size of your DB field, i.e. in above scenario we need to
increase the size of Email field,
change it to Nvarchar(50) and you’ll see error is gone.
Comments
Post a Comment