Q

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?

This Content Component encountered an error
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

Dig deeper on Microsoft SQL Server Performance Monitoring and Tuning

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close