sql server 2005 游标使用小例

declare @IP varchar(50),@Email varchar(50)
declare tc cursor for select HostIP,UserEmail from RestartLog
open tc
fetch next from tc into @IP ,  @Email
while @@fetch_status = 0
begin
    
print @IP+' '+@Email
    
fetch next from tc into @IP ,  @Email
end
close tc
deallocate tc
原文地址:https://www.cnblogs.com/xhan/p/1436438.html