title: EXECUTE @Var character limit SQL Server 2008 R2
body: <p>I've been looking all over for an answer to this, but nothing is explicit so hopefully someone knows off the top of their head.</p>
  
  <p>When using <code>EXECUTE</code> with a <code>VARCHAR(MAX)</code> variable, is there a character limit? I've done some experimenting and it seems that when load a variable and then call <code>EXECUTE @var</code>, there is a character limit on what is actually passed through to the server. When calling <code>EXECUTE</code> without the variable and just building the string there, everything appears to work.... is there a reason for this? The error message returned is: </p>
  
  <blockquote>
    <p><em>The Name ' (insert around 643 out of 881 characters of my SQL statement variable here) ' is not a valid identifier</em></p>
  </blockquote>
  
  <p>Does anybody know anything about why this might be happening? <code>EXECUTE @var</code> fails, <code>EXECUTE 'string'</code> works... </p>