怎样把游标参数赋值为游标查询结果集里的某一列啊?高分相送,在线等。。。。
declare SPHeart cursor for
select mobile,netsta from clientinfo c inner join remoteinfo r on c.username=r.viewusername
where datediff(minute,r.lastconnect,getdate())> 15
open SPHeart
declare @mobile varchar(50),
@netsta tinyint
FETCH NEXT FROM SPHeart into @mobile,@netsta
while (@@FETCH_STATUS=0)
begin
IF @netsta = 0 or @netsta = null
insert into send_sms(mobile,msgcontent) values(@MOBILE, '视频服务器网络异常请检查 ')
FETCH NEXT FROM SPHeart into @mobile,@netsta
end
CLOSE SPHeart
DEALLOCATE SPHeart
==========================================================================
我现在要把@netsta参数赋值为游标查询结果集里的netsta列,游标移动一行,执行一次 IF @netsta = 0 or @netsta = null
insert into send_sms(mobile,msgcontent) values(@MOBILE, '视频服务器网络异常请检查 ')
但问题我怎么给@netsta赋值啊,不赋值又怎么做判断?
------解决方案--------------------IF @netsta = 0 or @netsta is null
------解决方案--------------------不能将变量和null进行比较。
改为:
IF @netsta = 0 or @netsta is null