Character limit in a database field
I have an MS SQL Server 2000 database with a field which is a varchar(255). My clients understand that the text descriptions which they enter to describe an event is limited to 255 characters; however, what is happening is that MS SQL is truncating the description to be around 100 characters. The field was set to varchar(255) originally, and then the client wanted to enter a memo type description. So we altered the field type to another character type and found it did truncate to be less. We then put it back to a varchar(255). Do you have any solutions to this problem please?
Well, there's no use crying over spilt milk. There's no way to recover any of the data that was initially truncated because it was never stored in the database. All you can do now is set the column datatype to the appropriate size and then allow the customers to type away to their heart's delight.
The other element that you must check is the client application. Make sure the client application has not limited the text input length to 100 characters and that it can take all 255 characters. Once you've confirmed that, you're good to go for future data entry.
This was first published in August 2005