title: Convert nvarchar ISO-8601 date to datetime in SQL Server
body: <p>hopefully a quick one this.</p>
  
  <p>The below doesn't work:</p>
  
  <pre><code>DECLARE @stringDate nvarchar(50)
  SET @stringDate = '0001-01-01T12:00:00'
  
  SELECT 
      @stringDate AS StringDate,
      CONVERT(datetime, @stringDate, 126) AS ConvertedDate
  </code></pre>
  
  <p>Produces the error: The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.</p>
  
  <p>What's the simplest way of achieving the conversion?</p>
  
  <p>Thanks</p>