I am using SQL Server 2000. When I try to update a column of type varchar(20) with a text value of more than 10 characters, I get an error
String or binary data would be truncated.
Why is it? varchar(20) should accept a text of up to 20 characters… why can I not update it with text with more than 10 characters?
If your string variable is declared as
nvarchar(n), then it will take up twice as much space as avarchar(n)So, anything greater than 10 double-byte chars will not fit into a
varchar(20)If you are inserting/updating into a column of type
varchar, also declare your string variable asvarcharwith the appropriate size.