begin
DECLARE @keyID int;
declare c_test_main cursor fast_forward for SELECT ID FROM table ;
open c_test_main;--打开游标
while 1=1 --开始循环
begin
fetch next from c_test_main into @keyID --赋值到变量中
if(@@fetch_status!=0)break;--如果没有结果退出循环

    print @keyID    end
close c_test_main --关闭游标
deallocate c_test_main --释放游标
end

 

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-07-11
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-08-24
相关资源
相似解决方案