September 25, 2016 at 3:23 am
Comments posted to this topic are about the item Comparing with NULL
God is real, unless declared integer.
September 25, 2016 at 11:16 pm
Nice one
it's null's fault 🙂
September 26, 2016 at 12:34 am
Nice question, but the correct answer is as usual: "It depends". In this case on the setting of ANSI_NULLS.
September 26, 2016 at 12:44 am
Rune Bivrin (9/26/2016)
Nice question, but the correct answer is as usual: "It depends". In this case on the setting of ANSI_NULLS.
Good one! SET ANSI_NULLS ON / OFF; makes a difference
September 26, 2016 at 4:40 am
This was removed by the editor as SPAM
September 26, 2016 at 5:08 am
A simple question to highlight an important concept. Thanks.
September 26, 2016 at 6:49 am
One of my reoccurring frustrations is that very few people understand that NULL is not a value. It is the absence of a value.
It doesn't really seem that hard, does it?
September 26, 2016 at 6:58 am
Stewart "Arturius" Campbell (9/26/2016)
Nice question, thanks Thomas.The ANSI NULLS setting, will, of course, impact the final outputs.
Didn't know that. Makes sense.
September 26, 2016 at 7:00 am
Should be something like "is null" for the compare. Another gotcha would be to do something like CASE X WHEN NULL, which fails.
September 26, 2016 at 9:50 am
Very witty. Thanks, Thomas!
September 26, 2016 at 10:55 am
Updated the question to say ANSI_NULLS set to ON.
Note, at some point, this will be the only setting allowed.
September 26, 2016 at 12:52 pm
Steve Jones - SSC Editor (9/26/2016)
Updated the question to say ANSI_NULLS set to ON.Note, at some point, this will be the only setting allowed.
Thanks, Steve! While I think it's fair* to assume deprecated features are not used unless explicitly stated, it's always best if the question is clear.
For reference on deprecated features: https://msdn.microsoft.com/en-us/library/ms143729.aspx
(Personally, I'm a little disappointed that SET ANSI_NULLS OFF, SET ANSI_PADDING OFF, and SET CONCAT_NULL_YIELDS_NULL OFF are still supported in SQL 2016, let alone the next version.)
*Fair in terms of a QotD - in real-world work, always check!
September 27, 2016 at 9:04 am
Thanks, great question.
- webrunner
P.S. I see the following code returns false, true.
SELECT CASE
WHEN (9999 IS NULL) THEN
'true'
ELSE
'false'
END,
CASE
WHEN NOT (9999 IS NULL) THEN
'true'
ELSE
'false'
END;
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
September 29, 2016 at 6:20 am
Easy one, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply