How do you check for NULL in a CASE statement, when you’re using a Scalar Function?
My original query was … but it fails
SELECT CASE dbo.fnCarerResponse('')
WHEN NULL THEN 'Pass'
ELSE 'Fail'
END
I read the SO question about using IS NULL, like so …
SELECT CASE dbo.fnCarerResponse('') IS NULL
WHEN NULL THEN 'Pass'
ELSE 'Fail'
END
but this gives the incorrect syntax near the keyword is error
Can you have a Scalar Function in the CASE ?
You are using the wrong style of
CASE– you need to useCASE WHEN <expression> THENnotCASE <expression> WHEN <expression> then: