Shaun McGuile (2/2/2009)
REPLICATE function is obviously broken then.
Hi Shaun,
No, it's not. It just adheres to the standard operating procedure of datatype in = datatype out.
CREATE TABLE #t
(ID int,
LongName nvarchar(MAX));
INSERT #t
VALUES (1, REPLICATE(CAST(N'A' AS nvarchar(MAX)), 4000000));
SELECT DATALENGTH(LongName) FROM #t WHERE ID = 1;
Returns 8000000.