大尾巴狼

所谓大尾巴狼,就是装腔作势。

列相等与不等

declare @f1 int, @v1 int
set @f1=null
set @v1=null
if @f1=@v1 or (@f1 is null and @v1 is null) print '相同' else print '不同'
if @f1<>@v1 or (@f1 is null and @v1 is not null) or (@f1 is not null and @v1 is null)
 print '不同' else print '相同'

print '------------------------------------------'
set @f1=1
set @v1=1
if @f1=@v1 or (@f1 is null and @v1 is null) print '相同' else print '不同'
if @f1<>@v1 or (@f1 is null and @v1 is not null) or (@f1 is not null and @v1 is null)
 print '不同' else print '相同'

print '------------------------------------------' 
set @f1=1
set @v1=null
if @f1=@v1 or (@f1 is null and @v1 is null) print '相同' else print '不同'
if @f1<>@v1 or (@f1 is null and @v1 is not null) or (@f1 is not null and @v1 is null)
 print '不同' else print '相同'

print '------------------------------------------'
set @f1=null
set @v1=1
if @f1=@v1 or (@f1 is null and @v1 is null) print '相同' else print '不同'
if @f1<>@v1 or (@f1 is null and @v1 is not null) or (@f1 is not null and @v1 is null)
 print '不同' else print '相同'

print '------------------------------------------'
set @f1=0
set @v1=1
if @f1=@v1 or (@f1 is null and @v1 is null) print '相同' else print '不同'
if @f1<>@v1 or (@f1 is null and @v1 is not null) or (@f1 is not null and @v1 is null)
 print '不同' else print '相同'

print '------------------------------------------' 

解决由于Null致使逻辑运算产生的误差

posted on 2010-01-23 22:46 大尾巴狼 阅读(48) 评论(0) 编辑 收藏

<2010年1月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

导航

统计

公告

点击这里给我发消息
Locations of visitors to this page
昵称:大尾巴狼
园龄:7年10个月
粉丝:1
关注:0

搜索

 
 

常用链接

最新随笔

随笔分类(46)

随笔档案(38)

文章分类(9)

文章档案(9)

coworker

开源项目

值得一看

积分与排名

最新评论

阅读排行榜

推荐排行榜