title: SQL Date Range Split
body: <p>Can you please let me know the SQL to split date ranges when they overlap?</p>
  
  <p>Data (sample data with a date range and possibly other columns):</p>
  
  <pre><code>    Col1 FromDate ToDate
   1. 1    1/1/2008 31/12/2010
   2. 1    1/1/2009 31/12/2012
   3. 1    1/1/2009 31/12/2014
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>   Col1  From Date ToDate
  1. 1     1/1/2008 31/12/2008 (from row 1 above)
  2. 1     1/1/2009 31/12/2010 (from rows 1,2 and 3 above)
  3. 1     1/1/2011 31/12/2012 (from rows 2 and 3 above)
  4. 1     1/1/2013 31/12/2014 (from row 3 above)
  </code></pre>