玩转SQL中的ANSI_NULLS

declare @null    varchar(1);
set @null = null;

if (@null is null)
begin
    
print 'is null always works not matter "ANSI_NULLS" variable ';
end

set ANSI_NULLS OFF
if (@null = null)
begin
    
print '= null works when "ANSI_NULLS" = OFF only';
end

set ANSI_NULLS ON
if  not exists(select 1 where @null =null)
begin
    
print '= null not works when "ANSI_NULLS" <> OFF';
end
原文地址:https://www.cnblogs.com/rockniu/p/1193280.html