日期:2014-05-18  浏览次数:20420 次

取不到空值?再现等解决马上给分
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 '