I have a query as below:
SELECT * FROM Members (NOLOCK)
WHERE Phone= dbo.FormatPhone(@Phone)
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).
Set @SomeVar = dbo.FormatPhone(@Phone)
SELECT *
FROM Members (NOLOCK) WHERE Phone= @SomeVar
Which way is better or both are good?
EDIT: And how is first query different from
SELECT * FROM Members (NOLOCK)
WHERE dbo.FormatPhone(Phone) = @Phone