SQL 2005 nvarchar(max) problem
I have the following in a stored procedure:
DECLARE @TSQL NVARCHAR(MAX)
SET @TSQL = N'.....' Which contains about 33000 characters of text
When I do a PRINT LEN(@TSQL) 7968
is returned. Why is the rest of @TSQL c开发者_StackOverflowut off?
Make sure that when you concatenate everything is a nvarchar(max)
take a look at this
DECLARE @n NVARCHAR(MAX)
SELECT @n = REPLICATE(convert(varchar(max),'A'),300000)
select LEN(@n), DATALENGTH(@n)
GO
--300000 600000
DECLARE @n NVARCHAR(MAX)
SELECT @n = REPLICATE('A',300000)
select LEN(@n), DATALENGTH(@n)
--8000 16000
精彩评论