SELECT col1, col2, dbo.myFunc(@param1, @param2, col1, col2) FROM theTable
How do I add a WHERE here to the result of the function dbo.myFunc, like WHERE resultOfMyFunc > 10 for example?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just use the exact function call you use in the select in the query – the query optimizer should cache the value and use it in both places without re-evaluating the function (this is true for MSSQL, at least).
E.g.,