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
==========================================================================
[email protected]etsta列,游标移动一行,执行一次 IF @netsta = 0 or @netsta = null
insert into send_sms(mobile,msgcontent) values(@MOBILE, '视频服务器网络异常请检查 ')
[email protected],不赋值又怎么做判断?
------解决方案--------------------
IF @netsta = 0 or @netsta is null
------解决方案--------------------
不能将变量和null进行比较。
改为:
IF @netsta = 0 or @netsta is null