title: SQL Server convert varchar into datetime to select date range
body: <p>I need to select a date range from a MSSQL database but the s.ended field has not been set up as a datetime field.  It has been set up as a varchar and the format for the date stored is  <code>d/m/Y</code>.  </p>
  
  <p>I have tried the below were clause but I get the below error message.  Does anyone know of how I can get round this without changing the database design?  </p>
  
  <p>Where clause: </p>
  
  <pre><code>WHERE  
     (S.ended &gt; CONVERT(DateTime, '28/07/2012 00:00:01', 103)) 
     AND (S.ended &lt; CONVERT(DateTime, '28/08/2012 00:00:01', 103))
  </code></pre>
  
  <p>Error message:</p>
  
  <blockquote>
    <p><em>The conversion of a varchar datatype to a datetime data type resulted in an out of range value.</em></p>
  </blockquote>