title: nvarchar(max) still being truncated
body: <p>So I'm writing a stored procedure in MS SQL Server 2008. It's a really long query and I have to write it dynamically, so I create a variable called <code>@Query</code> and make it of type <code>NVARCHAR(MAX)</code>. Now, I have been <em>told</em> that in modern versions of SQL Server, <code>NVARCHAR(MAX)</code> can hold a ridiculous amount of data, way more than the original 4000 character maximum. However, <code>@Query</code> is still getting truncated to 4000 characters when I try to print it out.</p>
  
  <pre><code>DECLARE @Query NVARCHAR(max);
  SET @Query = 'SELECT...' -- some of the query gets set here
  SET @Query = @Query + '...' -- more query gets added on, etc.
  
  -- later on...
  PRINT LEN(@Query) -- Prints out 4273, which is correct as far as I can tell
  PRINT @Query      -- Truncates value to 4000 characters
  EXEC sp_executesql @Query -- totally crashes due to malformed (truncated) query
  </code></pre>
  
  <p>Am I doing something incorrectly, or am I completely wrong about how <code>NVARCHAR(MAX)</code> works?</p>