title: Using function in where clause: how many times is the function evaluated?
body: <p>If I use a function in a where clause, how many times is it evaluated?  I'm wondering about the effect on performance in more complicated queries.</p>
  
  <p>example:</p>
  
  <pre><code>select 
  col1, col2, expirationDate
  from someTable
  where expirationDate &gt; getdate()
  </code></pre>
  
  <p>versus</p>
  
  <pre><code>declare @today date = getdate()
  select 
  col1, col2, expirationDate
  from someTable
  where expirationDate &gt; @today
  </code></pre>