NOT IN NULL

Kevin Feasel

2016-08-15

T-SQL

Jen McCown warns against NULL in NOT IN statements:

The IF statement asks: “is 1 in the collection of values (2, NULL)?” And we must say, “ah, no idea. That can’t be proven. Therefore we can’t return true.”

The value 1 cannot be determined to not be in the set of (2, NULL).

NULL is a strange bird.

Related Posts

T-SQL Join Delete

Steve Stedman walks us through a bit of T-SQL proprietary syntax: 1 2 3 DELETE t2 FROM [dbo].[Table1] t1 INNER JOIN [dbo].[Table2] t2 on t1.favColor = t2.id; Names have been changed to protect the innocent. In the above delete statement which table will have rows deleted from it? A: Table1 B: Table2 C: Both Table1 […]

Read More

Date And Time Functions To Avoid

Randolph West shares his thoughts on three functions he’d rather you avoid: CURRENT_TIMESTAMP is the ANSI-equivalent of GETDATE(). ANSI is an acronym for the American National Standards Institute, and sometimes vendors will include ANSI functions in their products so they can say that they’re ANSI-compliant (which is not a bad thing, in most cases). There are three main problems […]

Read More

Categories

August 2016
MTWTFSS
« Jul Sep »
1234567
891011121314
15161718192021
22232425262728
293031