DB Options: SET ANSI Nulls

By | March 18, 2020


ANSI NULLS dictate how SQL Server responds when the equal to (=) operator is used to check for NULLs. Keep in mind that the IS NULL condition works regardless of what ANSI NULL setting is used. When ANSI NULLS are ON using a query like ColA =NULL will not return any results. Setting ANSI NULLS to OFF will return results when the query uses ColA =NULL. In this video we show that IS NULL check performs faster and therefore this setting is practically useless in any real world database design / programming. Luckily it’s on its way out. This option is always going to default on ON in future but it is also part of ANSI DEFAULTs setting where in Session context it is always set to ON. Yet again in this video we see a database option that is overridden at the session level and therefore doesn’t serve any purpose.