Get started Bring yourself up to speed with our introductory content.

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.

Dig Deeper on iSeries SQL commands and statements

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.