Skip to the content.

Nothing compares to null; not even null. Nothing is ever equal to null, but also nothing is ever not equal to null; all comparisons return false (at least, unless you’re running with exotic configuration options).

To correctly compare to null, you should use is [not] null.

Bad:

select A, B
from SomeTable
where X = null
and Y <> null

Good:

select A, B
from SomeTable
where X is null
and Y is not null