title: SQL Server 2008 VarChar(Max) returns only 8000 Characters. Why?
body: <pre><code>PRINT Convert(VarChar(Max),Replicate('1234567890 ',1000))
  </code></pre>
  
  <p>This returns to the window 7,997 characters.</p>
  
  <pre><code>SELECT Convert(VarChar(Max),Replicate('1234567890 ',1000))
  </code></pre>
  
  <p>This returns to the grid 7,996 characters. The extra character in the print window is a CRLF. I have my options as such:
  Tools → Options → Query Results → Results to Text → Maximum number of characters displayed in each column = 8192</p>
  
  <p>So, I would expect 8,192 characters to be returned in the grid, and I would expect 11,001 characters to be returned to my window. </p>
  
  <p>Then there's this test:</p>
  
  <pre><code>DECLARE @VarCharMax VarChar(Max)
  SET @VarCharMax = Replicate('123456',2000)
  SELECT Right(@VarCharMax,3) -- returns 456
  SELECT Right(Left(@VarCharMax,8000),3) -- returns 456
  SELECT Right(Left(@VarCharMax,7999),3) -- returns 456
  SELECT Right(Left(@VarCharMax,7998),3) -- returns 456
  SELECT Right(Left(@VarCharMax,7997),3) -- returns 345
  SELECT Right(Left(@VarCharMax,7996),3) -- returns 234
  </code></pre>
  
  <p>What am I missing in understanding here? It doesn't seem to behave at all as I would expect?</p>