DB Options: SET ANSI Nulls

By | 2020-03-18

https://youtu.be/QfB2v6QQej8

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.

Category: Uncategorized

About admin

This post was written by Jayanth Kurup. A Microsoft SQL Server Consultant and Trainer based out of Bangalore, India. Jayanth has been working on MS SQL Server for over 15 years. He is a performance tuning and Business Intelligence expert. Having worked with companies like Microsoft, DELL, Wells Fargo, Thomson Reuters and many other fortune 100 companies. Some other technologies Jayanth works on include Microsoft Azure, PowerBI, Python and AWS. When he isn’t consulting or training, Jayanth like to travel, paint and read. He is also very active in social causes and the founder of Enabled Business Solutions. Visit his company by clicking the link in the menu or email him directly.