Artur Komkov (12/9/2010)
What's why I always try to avoid nullable columns or make something like that:select * from dbo.Employees where EmployeeID
not in (SELECT isnull(NullableColumn,0) FROM NullOperation)
While that would indeed avoid this issue, it also makes it a lot harder for the optimizer to use an index (if any) on the NullableColumn. Here is an alternative that will still use indexes:
SELECT * -- Use column list instead!
FROM dbo.Employees AS e
WHERE NOT EXISTS
(SELECT *
FROM NullOperation AS n
WHERE n.NullableColumn = e.EmployeeID);