title: Compare time portion of datetime values in sql
body: <p>How to compare only the time portion of datetime values in sql.</p>
  
  <p>I have tried it with the following way,</p>
  
  <pre><code> DECLARE @t1  smalldatetime
   SET @t1=CAST('1900-01-01 '+CONVERT(varchar(8),@saledate,108) As smalldatetime) 
   --------------------------------------------------------------------------------
  
   SELECT Model FROM  Sales WHERE @t1 between WorkStart  and WorkEnd And Ctrl=@key
  </code></pre>
  
  <p>'WorkStart' and 'WorkEnd' is a DateTime field and the date portion always contains '1900-01-01'.</p>
  
  <p>And the parameter @saledate is a datetime, how can i compare only the time portion without consider the date portion of @saledate,workstart and workend. </p>
  
  <p>The table already created the WorkStart and WorkEnd with DateTime field and i cannot modify the field datatype as it is currently being used.</p>