Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String output

Status
Not open for further replies.

chintapalli

Programmer
Mar 15, 2002
10
US
Hi,

SQL Server 7.0 returns 256 characters of a table field with NVarChar 4000 length. Does anyone know why?

Here is the sample code:
****************************Code begins***************
CREATE PROCEDURE SQLLengthTest AS

DECLARE @STRtEST NVARCHAR(4000)

SET @STRtEST = 'HarishABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefgihjklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefgihjklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefgihjklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefgihjklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefgihjklmopqrstuvwxyz'

SELECT @STRtEST
--This returns full string length > 256 characters

CREATE TABLE #Test
(L NVARCHAR(4000))

INSERT INTO #Test VALUES(@STRtEST)

SELECT *
FROM #Test
--This returns string length = 256 characters only
***************************Code ends here**************

Thanks.

Harish.
 
If you are using SQL Query Analyzer, the default setting for maximum column length is 256. Open the QA Options, click on the results tab and change the value. It can be as large as 8000. (SQL 2000) Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top