日期:2014-05-18 浏览次数:20602 次
declare @alive bit; set @alive = null; if @alive = 1 or @alive != 1 print 'Alive or Dead'; else print 'Huh? Neither alive nor dead'; if @alive=@alive PRINT 'It must equal itself, right?' ELSE PRINT 'Not always. null does not equal null';
declare @alive bit; set @alive = null; if @alive = 1 or @alive != 1 print 'Alive or Dead'; else print 'Huh? Neither alive nor dead'; if null is null PRINT 'It must equal itself, right?' ELSE PRINT 'Not always. null does not equal null'; /* Huh? Neither alive nor dead It must equal itself, right?
------解决方案--------------------
Null is woman's looks
------解决方案--------------------
null does not equal null
------解决方案--------------------
What would be the output ? declare @a smallint set @a = 0 select nullif ( @a , '' )
------解决方案--------------------
NULL<>''
------解决方案--------------------
mark
------解决方案--------------------
null does not equal null!
null is null!
------解决方案--------------------
俺只会中文
NULL确实不能比较只能IS
------解决方案--------------------
改了配置已经可以比较哦
------解决方案--------------------
都是些外国人。呵呵 null是什么都没有的意思。所以由此所得 null就不是数字
------解决方案--------------------
is null
------解决方案--------------------
其实楼主是拉晒英文呢
------解决方案--------------------
null=undefined value=未知
------解决方案--------------------
set ansi_nulls off后结果就不同了.
set ansi_nulls off declare @alive bit; set @alive = null; if @alive = 1 or @alive != 1 print 'Alive or Dead'; else print 'Huh? Neither alive nor dead'; if @alive=@alive PRINT 'It must equal itself, right?' ELSE PRINT 'Not always. null does not equal null'; --> 结果 Alive or Dead It must equal itself, right?
------解决方案--------------------
null确实不能比较 但是可以通过 isnull转化在比较 isnull(字段,'') 如果是NULL则转化为 ‘’ 空字符串
------解决方案--------------------