开发者

SQL 2005 nvarchar(max) problem

开发者 https://www.devze.com 2023-01-30 06:14 出处:网络
I have the following in a stored procedure: DECLARE @TSQL NVARCHAR(MAX) SET @TSQL = N\'.....\' Which contains about 33000 characters of text

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

0

精彩评论

暂无评论...
验证码 换一张
取 消