create table TestTable (
TestColumn nvarchar(10)
)
insert into TestTable (TestColumn) values ('Test')
select * from TestTable where TestColumn not in (null)
Obviously this is a silly example but scales to any list that is a
query that could return null.
Can anyone clarify, or point me to some good docs on the behavior of
the in operator? BOL didn't seem to have anything specific on this
behavior.
TIA.
A row is returned if the WHERE clause is TRUE
In order for this to be TRUE testColumn = NULL must be FALSE
However 'Test' = NULL is UNKNOWN and which is different from FALSE
That is why there is an IS NULL predicate.
Here is a treatise on the dilemma of NULL:
http://www.dbdebunk.com/page/page/1706814.htm
Cheers
Serge
--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab
--
Plamen Ratchev
http://www.SQLStudio.com