I always endup doing this to cover all situations where @variable can be empty or null,
IF(COALESCE(@variable,'') <> '')
BEGIN
END
Is this the most optimal way to check this?
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.
If its a variable, then it shouldn’t matter. If you are doing a similar filter on a column of a table, then I would recommend:
WHERE Column IS NOT NULL OR Column <> ''as it mantains the use of a possible index on that column.