Thursday, February 25, 2010

LEN with NVARCHAR(MAX)

What will be the output of the following scripts if you run them in SQL Server 2005 Management Studio?
DECLARE @STR NVARCHAR(MAX)
SET @STR = REPLICATE('1',8001)
SELECT LEN(@STR)

A. 8001
B. 8000
C. An error will be generated since the nvarchar(max) data types are invalid for local variables.
D. An error will be generated since the maximum of LEN function is only 8000

Answer:[B]
Highlight to find out the answer.

No comments:

Post a Comment