title: filtering a DATETIMEOFFSET column to a local date range
body: <p>If I have a <a href="http://msdn.microsoft.com/en-us/library/bb630289.aspx" rel="nofollow"><code>DATETIMEOFFSET</code></a> column in a SQL Server table, what's the right way to filter results to a range of local (not UTC) dates?  By "local" I mean date boundaries are relative to the timezone of each stored value (which may differ between rows), not relative to a single fixed local timezone. </p>
  
  <p>I assume it's not this, because the <a href="http://msdn.microsoft.com/en-us/library/bb630352.aspx" rel="nofollow"><code>DATE</code></a> literals will be assumed to be UTC. Correct?</p>
  
  <pre><code>WHERE EventTime &gt;= '20140401' AND EventTime &lt; '20140501'
  </code></pre>
  
  <p>So is this the right solution?</p>
  
  <pre><code>WHERE CAST (EventTime AS DATE) &gt;= '20140401' AND CAST (EventTime AS DATE) &lt; '20140501'
  </code></pre>
  
  <p>Or does the CAST function prevent efficient use of indexes on the <code>EventTime</code> column?  If so, what's the right way to "align" date literals on the same timezone as the DATETIMEOFFSET column?</p>