title: String or binary data would be truncated. -- even though length shorter than field length
body: <p>Trying to prefix a string field on a table by using the UPDATE command. For some reason I'm getting the </p>
  
  <blockquote>
    <p>String or binary data would be truncated.</p>
  </blockquote>
  
  <p>exception, even though the length of my data would easily fit in the field.</p>
  
  <p>Using SQL Server 2008 R2 Standard Edition and SSMS 2008 R2.</p>
  
  <p><strike>Template: Learner is a nvarchar(60)</strike></p>
  
  <p><strong>Template: Learner is a nvarchar(30) using 60 bytes as shown in sp_help</strong></p>
  
  <pre class="lang-sql prettyprint-override"><code>select LEN('Aaaaaaaa' + LEFT(learner, 52)) myLen from Template order by myLen desc
  &gt;&gt;&gt; max len = 31
  
  update Template set learner = 'Aaaaaaaa' + LEFT(learner, 52)
  &gt;&gt;&gt; String or binary data would be truncated.
  
  update Template set learner = 'Aaaaaaaa' + LEFT(learner, 52)
  &gt;&gt;&gt; String or binary data would be truncated.
  
  update Template set learner = CAST('Aaaaaaaa' + LEFT(learner, 52) AS NVARCHAR(60))
  &gt;&gt;&gt; String or binary data would be truncated.
  </code></pre>
  
  <p>Whereas the following works:</p>
  
  <pre><code>SELECT CAST('Aaaaaaaa' + LEFT(learner, 52) AS NVARCHAR(60)) FROM Template
  </code></pre>