declare @var bit select @var = 0 if ISNULL (@Var,'') = '' print 'yes' else print 'no' the result is yes when i pass 0. But when i pass 1 for @var, it prints no. Can anyone explain Why does SQL Server considers 0 as NULLs?
Hi, SQL Server does not consider 0 = null, but converting '' to bit returns the same value as a 0 bit value (false). This should be clear if you change the above code to:declare @var bit select @var = 0 if @var = '' print 'yes'else print 'no'