title: Why does SQL Server require INT to be converted to NVARCHAR?
body: <p>During an ordeal yesterday, I learned that you can't pass this query to EXEC():</p>
  
  <pre><code>@SQL = @SQL + 'WHERE ID = ' + @SomeID
  EXCEC(@SQL)
  </code></pre>
  
  <p>Where @SomeID is an INT and @SQL is NVARCHAR. This will complain about not being able to convert NVARCHAR back to INT during execution.</p>
  
  <p>I realized you have to do it like</p>
  
  <pre><code>@SQL = @SQL + 'WHERE ID = ' + CONVERT(NVARCHAR(20), @SomeID)
  </code></pre>
  
  <p>What I didn't understand is why? Why doesn't SQL Server understand the INT when simply +:ed on to an NVARCHAR? I'm guessing it has something to do with char sets.</p>
  
  <p>EDIT: Fixed typos (missed some +:s).</p>