Q

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 last published in February 2005

Dig Deeper on iSeries SQL commands and statements

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.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close