title: How can I compare two datetime values in SQL Server 2005?
body: <p>I need to compare two <code>datetime</code> values in SQL Server 2005 as below.</p>
  
  <pre><code> case when min(@datetime1) &lt; max(@datetime2) then 0 else 1 end
  </code></pre>
  
  <p>I tried with the above condition even converting the <code>datetime</code> datatype into <code>varchar</code>. But I am not able to execute it. Can anybody help me?</p>
  
  <p>Thanks in advance</p>