字符串判断是否为空,该如何处理

字符串判断是否为空我有一个参数@friends varchar(50)select @friendsfriend from FriendTable where id

字符串判断是否为空
我有一个参数@friends varchar(50)
select @friends=friend from FriendTable where id=1002
friend此字段值为Null

if @friend=null
begin
  @friend = '1000020'
end
print @friend

为什么打印出来还是空的?



[解决办法]
is null
[解决办法]
if @friend=null 
begin 
@friend = '1000020 ' 
end 
print @friend 

------------------

if isnull(@friend,'')=''
begin 
@friend = '1000020 ' 
end 
print @friend 

[解决办法]
会不会是:if @friend is null
[解决办法]
if isnull(@friend,'')='' 
begin 
@friend = '1000020 ' 
end 
print @friend 

与NULL 比较都认为为 否