I have a simple stored procedure that looks something like this:
SET @email = NULL
SELECT * FROM empTable
WHERE email = ISNULL(@email, '')
@email will take input from the user. The problem is, the email column in the table can be an empty string or null (or an email).
If the user doesn't enter any value, it should return all Employees with either NULL or empty string email.
I have tried to following but it didn't work too:
SELECT *
FROM empTable
WHERE email = ISNULL(@email, '') OR email = ISNULL(@email, NULL)