title: Split query results with long strings into multiple rows in T-SQL
body: <p>I have a table in MS SQL Server that contains multiple TEXT fields that can have <em>very long</em> strings (from 0 characters to 100,000+ characters). </p>
  
  <p>I'd like to create a view (or a stored proc that populates a reporting table) that prepares this data for export to Excel, which has a certain character limit allowable per cell (32,767 chars).</p>
  
  <p>It's relatively trivial to write a query to truncate the fields after a certain number of characters, but I'd like to create new rows containing the text that would be truncated. </p>
  
  <p>Example - Row 1, Col1 and Col3 contains text that is wrapped into 2 rows.</p>
  
  <pre><code>ID   |   COL1   |   COL 2   |   COL 3   |
  1       AAAAAA     BBBBBBB     CCCCCC
  1       AAA                    CC
  2       XX         YY          ZZ   
  </code></pre>