title: SQL Server 2008 VarChar To DateTime
body: <p>I have a table where unfortunately a number of dates are stored as strings. </p>
  
  <p>I have a number of reports that cast them to datetimes and filter by them. This was working fine until today when all of a sudden i'm getting this error</p>
  
  <p>"The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."</p>
  
  <p>The dates are all stored in the format of "yyyy-mm-dd" and are all valid.</p>
  
  <p>If I run the following SQL statement</p>
  
  <pre><code>SELECT CAST('2010-06-02' AS DateTime) 
  </code></pre>
  
  <p>I would expect to get "2010-06-02" however as of today I'm getting "2010-02-06" something has changed with the way SQL formats dates. I've had a look in regional settings on the server and it all looks to be correct.</p>
  
  <p>What else could be causing this?</p>