Introduction

Specifies ISO compliant behavior of the Equals (=) and Not Equal To (<>) comparison operators when they are used with NULL values in SQL Server.

  • SET ANSI_NULLS ON – Evaluates both {expression} = NULL and {expression} <> NULL as False if the value of {expression} is NULL. This behavior is ANSI-compliant.
  • SET ANSI_NULLS OFF – Evaluates {expression} = NULL as True and {expression} <> NULL as False if the value of {expression} is NULL. This behavior is not recommended, because the NULL values should not be compared using = and <> operators.

Problem

Enable ANSI_NULLS

Solution

https://github.com/steverezhener/DBA/blob/master/Procedures/bestpractices.usp_change_ansi_nulls.sql