declare @a int select @a=max(id) from sysobjects where xtype='a' if @a = null begin print '111' end else begin print '222' end但是在和null比较时,是不同的....
NULL 值表示列的数据值未知或不可用 当搜索的列中包括定义为允许空值的列时,可以通过下列模式查找数据库中的空值或非空值:WHERE column_name IS [NOT] NULLdeclare @a int select @a=max(id) from sysobjects where xtype='a' if @a is null begin print '111' end else begin print '222' end
select @a=max(id) from sysobjects where xtype='a'
if @a = null
begin
print '111'
end
else
begin
print '222'
end但是在和null比较时,是不同的....
当搜索的列中包括定义为允许空值的列时,可以通过下列模式查找数据库中的空值或非空值:WHERE column_name IS [NOT] NULLdeclare @a int
select @a=max(id) from sysobjects where xtype='a'
if @a is null
begin
print '111'
end
else
begin
print '222'
end