January 10, 2017 at 1:06 pm
MMartin1 (1/10/2017)
drew.allen (1/10/2017)
MMartin1 (1/9/2017)
You forgot the NOT.
SELECT CASE WHEN NULL IS NOT NULL THEN NULL ELSE NULL END;
How about
SELECT CASE WHEN NULL IS NOT NULL THEN NOT NULL ELSE NULL END
?
same logical result to the original expression COALESCE(null, null) . Though if you keep going these nulls can start to become a head spinner.
CASE cannot return a Boolean predicate, and since NOT is a Boolean operator, you cannot return NOT NULL in your THEN clause.
Drew
Hence why I mentioned logically 🙂
Actually it's not logically equivalent. What I wrote is the logical equivalent. Let me clarify.
SELECT CASE WHEN NULLa IS NOT NULL THEN NULLa ELSE NULLb END;
You're returning the value being tested NULLa not the test that is being performed (IS NOT NULL).
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 10, 2017 at 1:18 pm
It is as far as the end result being deterministic and resulting in NULL. I thought that was the scope here since your/our statement(s) will not even execute in SQL Server, as Brandi pointed out 😀
----------------------------------------------------
January 11, 2017 at 6:45 am
This thread went nowhere, very quickly, with the isnull discussion totally irrellevant to the OP's question. I hope you can still filter out the various options presented, komal145?
Viewing 3 posts - 31 through 32 (of 32 total)
You must be logged in to reply to this topic. Login to reply