I just came across an interesting problem with a procedure I am writing in SQL.
In my proc I have 2 dates, which are optional params defaulted to NULL, I want to che
Care must be taken when comparing null values. The behavior of the comparison depends on the setting of the SET ANSI_NULLS option.
When SET ANSI_NULLS is ON, a comparison in which one or more of the expressions is NULL does not yield either TRUE or FALSE; it yields UNKNOWN. This is because a value that is unknown cannot be compared logically against any other value. This occurs if either an expression is compared to the literal NULL, or if two expressions are compared and one of them evaluates to NULL.
See NULL Comparison Search Conditions