title: How to use DATEDIFF SQL Server function and still benefit from the index?
body: <p>My SQL statement includes the following where clause:</p>
  
  <pre><code>DATEDIFF(day,LastActivityTimestamp,getdate()) &gt; 90
  </code></pre>
  
  <p>But the index on the LastActivityTimestamp does not play here. How can I rewrite it to take advantage of the index?</p>