NULL不是数值
时间:2011-12-28
来源:互联网
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';
Huh? Neither alive nor dead
Not always. null does not equal null
代码挺有意思的。
作者: houyajin 发布时间: 2011-12-28
作者: qianjin036a 发布时间: 2011-12-28
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?
作者: Monkey__D__Luffy 发布时间: 2011-12-28
作者: qianjin036a 发布时间: 2011-12-28
作者: Beirut 发布时间: 2011-12-28
What would be the output ? declare @a smallint set @a = 0 select nullif ( @a , '' )
这个更有意思
作者: Beirut 发布时间: 2011-12-28
作者: fredrickhu 发布时间: 2011-12-28

mark
作者: ju523756055 发布时间: 2011-12-28
null is null!
作者: maco_wang 发布时间: 2011-12-28
NULL确实不能比较只能IS
作者: futulove 发布时间: 2011-12-28

作者: kuqideyupian 发布时间: 2011-12-28
俺只会中文
NULL确实不能比较只能IS
作者: q465897859 发布时间: 2011-12-28
作者: szstephenzhou 发布时间: 2011-12-28
作者: rings2000 发布时间: 2011-12-28

作者: Beirut 发布时间: 2011-12-28
作者: roy_88 发布时间: 2011-12-28
SQL code
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?
作者: ap0405140 发布时间: 2011-12-28
作者: feng1366259807 发布时间: 2011-12-28
SQL code
What would be the output ?
declare @a smallint
set @a = 0
select nullif ( @a , '' )
这个更有意思
见识了。
作者: houyajin 发布时间: 2011-12-28
其实楼主是拉晒英文呢
挂这么多牌牌,还欺负人么?
偶要是英文好,就不写一个汉字。
作者: houyajin 发布时间: 2011-12-28
set ansi_nulls off后结果就不同了.
SQL code
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';……
这个好玩。下班!!
作者: houyajin 发布时间: 2011-12-28
引用 14 楼 beirut 的回复:
其实楼主是拉晒英文呢
挂这么多牌牌,还欺负人么?
偶要是英文好,就不写一个汉字。
哪有欺负你的味道我怎么看不出来。
作者: Beirut 发布时间: 2011-12-28
引用 5 楼 beirut 的回复:
SQL code
What would be the output ?
declare @a smallint
set @a = 0
select nullif ( @a , '' )
这个更有意思
见识了。
能引起注意 不容易啊,哥的回答向来不被别人重视
作者: Beirut 发布时间: 2011-12-28
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28