title: Function call in where clause
body: <p>I have a query as below:</p>
  
  <pre><code>SELECT * FROM Members (NOLOCK) 
   WHERE Phone= dbo.FormatPhone(@Phone)
  </code></pre>
  
  <p>Now here I understand that formatting has to be applied on the variable on column. But should I apply it on variable to assign to some other local variable then use it (as below).</p>
  
  <pre><code>Set @SomeVar = dbo.FormatPhone(@Phone) 
  
  SELECT * 
    FROM Members (NOLOCK) WHERE Phone= @SomeVar
  </code></pre>
  
  <p>Which way is better or both are good?</p>
  
  <p>EDIT: And how is first query different from </p>
  
  <pre><code>SELECT * FROM Members (NOLOCK) 
   WHERE dbo.FormatPhone(Phone) = @Phone
  </code></pre>