title: How to convert date time format in SQL Server like '2017-03-04 10:07:03.490' to date format which is seperated by - like '2-11-2016'
body: <p>I am tying to make date comparison with the query </p>
  
  <pre><code>select * 
  from dbo.OH_Case   
  where dbo.OH_Case.CreatedDate between Convert(varchar(30),'24/04/2017', 102)  
                                    and Convert(varchar(30),'01/05/2017', 102) 
  </code></pre>
  
  <p>but it throws this error:</p>
  
  <blockquote>
    <p>Msg 242, Level 16, State 3, Line 1<br>
    The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.</p>
  </blockquote>
  
  <p>My application passes data in '01/05/2017' format and the date information in SQL Server is stored in '2017-03-04 10:07:03.490' format. What should I do to make both of these in same format which allows comparison?</p>