If you are using the NOT IN clause with a SQL Select statement with SQL Server it will not work if there is a null value in the list. Say for example you want to do:
SELECT * FROM Employees Where Employee.Id NOT IN ( Select EmployeeId from Salaries where Salary < 100000 )
If the inner select returns a null value then the outer select statement will return no rows.
To try it, just run these 2 SQL statments against any table in your DB.
-- will return rows SELECT * FROM sometable WHERE ID NOT IN (1,2,3) -- will return nothing SELECT * FROM sometable WHERE ID NOT IN (1,2,3, null)
Remember Me
Powered by: newtelligence dasBlog 1.9.6264.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
E-mail
Theme design by Jelle Druyts