触发器里怎么与空值比较。
在触发器里怎么与空值进行比较。
declare @s_phone varchar(15);
set @s_phone1=new_torder_telephone.person_phone2;
if @s_phone1=null then
set @s_phone='此次配送优先联系:'+ new_torder_telephone.person_phone1;
else
set @s_phone='来电号码:'+ new_torder_telephone.person_phone1 + '此次配送优先联系:' +new_torder_telephone.person_phone2;
end if ;
当 @s_phone1为空值的时候,怎么都执行不到set @s_phone='此次配送优先联系:'+ new_torder_telephone.person_phone1;这句。
[解决办法]
是空值还是NULL?
if @s_phone1 IS null then ....