title: How to compare dates in SQL Server
body: <p>I have an HTML form where I ask the user to select dates and then hit submit. Upon submitting, I am trying to fetch records between the selected dates using ColdFusion. My query looks like this:</p>
  
  <pre><code>SELECT  * 
  FROM    user_activation_events
  where   STATUS_CODE =1
  AND     event_date &gt;= #Dateformat(form.from_date, 'dd-mm-yyyy')#
  AND     event_date &lt;= #Dateformat(form.to_date, 'dd-mm-yyyy')#
  </code></pre>
  
  <p>But this does not work as the date is stored in the database in this format: </p>
  
  <pre><code>    yyyy-mm-dd hh:mm:ss
  </code></pre>
  
  <p>Can somebody please tell me how to do it?</p>