SET ANSI_NULLS OFF instructs the server to evaluate statements containing NULL using non-standard semantics.
SET ANSI_NULLS OFF; SELECT CASE WHEN NULL = NULL THEN 1 ELSE 0 END;
You should never create new code with the non-standard semantics parameter SET ANSI_NULLS OFF , because:
- It is never necessary
- For database queries that behave with rich semantics that occur when
NULL processed differently than any other value (for example, in the WHERE ), values compared to NULL should always return False / UNKNOWN. - This makes the code more difficult to maintain, as developers may not realize that it uses custom configuration or is confused by it, and
- Microsoft warned that in a future version of SQL Server this option will cause a clear error.
Michael currie
source share