In SQL server if you have nullParam=NULL in a where clause, it always evaluates to false. This is counterintuitive and has caused me many errors. I do understa
nullParam=NULL
Because NULL means 'unknown value' and two unknown values cannot be equal.
NULL
So, if to our logic NULL N°1 is equal to NULL N°2, then we have to tell that somehow:
SELECT 1 WHERE ISNULL(nullParam1, -1) = ISNULL(nullParam2, -1)
where known value -1 N°1 is equal to -1 N°2
-1