title: Maximum row size exceeds the allowed maximum of 8060 bytes
body: <p>In run Microsoft SQL Server 2014. Upon altering a table, I get a warning about the row size.</p>
  
  <pre><code>ALTER TABLE myTable
      ALTER COLUMN aRandomColumn NVARCHAR(10);
  
  Warning: The table "myTable" has been created, but its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit.
  </code></pre>
  
  <p>The table has 75 columns:</p>
  
  <ul>
  <li>13 date</li>
  <li>9 bit</li>
  <li>8 int</li>
  <li>5 decimal(18,5)</li>
  <li>4 bigint</li>
  <li>3 money</li>
  <li>19 nvarchar(10)</li>
  <li>10 nvarchar(20)</li>
  <li>1 nvarchar(30)</li>
  <li>1 nvarchar(40)</li>
  <li>2 nvarchar(50)</li>
  </ul>
  
  <p>By my calculations, the nvarchars take up 1120 bytes, the other columns 121 (not sure but it won't be much more).</p>
  
  <p><strong>How does this exceed 8060 bytes? How can I get rid of this warning?</strong></p>
  
  <p>Tried to sum all columns with <code>isnull(datalength(myColumnName), 1)</code> and the actual data never exceeds 600.</p>
  
  <p>Found <a href="https://stackoverflow.com/questions/45694198/why-does-my-row-size-exceed-the-allowed-maximum-of-8060-bytes">a similar question</a> but change tracking is off for me, so it didn't help. Also cleantable, found in <a href="https://stackoverflow.com/questions/18193157/maximum-row-size-of-8060-error">this question</a>, didn't help.</p>
  
  <p>However, when I copy the table, the new table does not produce this warning.</p>
  
  <pre><code>SELECT * INTO myNewTable FROM myTable;
  -- (8561 row(s) affected)
  ALTER TABLE myNewTable
      ATLER COLUMN aRandomColumn NVARCHAR(10);
  -- Command(s) completed successfully.
  </code></pre>