Ask the Expert

Getting truncated values on SQL Server

My MS SQL Server 2000 database has two fields, one with varchar of 1000 characters and the other with nvarchar(1000), and 1000 characters are stored in the database. When I retrieve through select query and place it in a text area, I am not receiving the whole string of information, but rather a truncated value of only 256 characters. How can I get all the 1000 chars present in the database?
Are you sure that there are actually 1000 characters in the column(s)? If not, use the LEN function to return the number of characters excluding trailing blanks. If the result is not 1000, then there are not 1000 characters stored in the column.

If there are 1000 characters, but you continue to get only 256 of them, consider the following:

  • If you are issuing the query from an application, try to run the query outside of the program (in Enterprise Manager) to see if the results are the same.

  • DB-Library applications and applications using the SQL Server ODBC drivers from SQL Server version 6.5 or earlier support only a maximum of 255 bytes of character data. If these applications attempt to retrieve character parameters of SQL Server version 7.0 or later, or result set columns containing more than 255 bytes of data, the character data is truncated at 255 bytes.

This was first published in February 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: