【ANSI_NULLS】の使い方 SQL Server
sql server でnull値同士で比較したい場合
ANSI_NULLS
null値の比較をするとときにこれがoffだとtrue
onだとfasleが変える
SET ANSI_NULLS ON DECLARE @test AS INT declare @test2 as int set @test = NULL set @test2 = NULL declare @isnull as nvarchar(max) declare @isnotnull as nvarchar(max) set @isnull = 'null許容' set @isnotnull = 'null非許容' if @test = @test2 begin select @isnotnull end else begin select @isnull end