首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

取不到空值?再现等解决马上给分解决方法

2012-02-10 
取不到空值?再现等解决马上给分declare@msmalldatetimeselecttop1@mQDatefromqynoteswhereQUID1if(@mnu

取不到空值?再现等解决马上给分
declare   @m   smalldatetime
select   top   1   @m=QDate     from   qynotes   where   QUID=1
if   (@m=null)
print   'nono '

实际中where   QUID=1的纪录并不存在。此时@m应该为null巴。可是为什么不打印出nono。
更奇怪的是如果我写成if   (@m!=null)print   'nono '
同样也不打印。到底此时@m的值是多少?我该如何判断!

如果where   QUID=1有记录一切都正常的!

[解决办法]
if (@m is not null) print 'nono '

热点排行
Bad Request.