PRINT Convert(VarChar(Max),Replicate('1234567890 ',1000))
This returns 7997 characters to the window.
SELECT Convert(VarChar(Max),Replicate('1234567890 ',1000))
This returns 7996 characters to the grid. An additional character in the print window is CRLF. I have my options: Tools → Options → Query Results → Results for text → Maximum number of characters displayed in each column = 8192
So, I would expect 8,119 characters to be returned in the grid, and I expect 11,001 characters to return to my window.
Then this test:
DECLARE @VarCharMax VarChar(Max)
SET @VarCharMax = Replicate('123456',2000)
SELECT Right(@VarCharMax,3)
SELECT Right(Left(@VarCharMax,8000),3)
SELECT Right(Left(@VarCharMax,7999),3)
SELECT Right(Left(@VarCharMax,7998),3)
SELECT Right(Left(@VarCharMax,7997),3)
SELECT Right(Left(@VarCharMax,7996),3)
What am I missing in understanding here? It seems that he does not behave at all as I expected?
source
share