ITPub博客

首页 > 数据库 > > sqlserver 游标小例

sqlserver 游标小例

作者:TTT1234 时间:2023-02-17 16:00:34 0 删除 编辑

总忘,小记

declare @c int
declare @seq int
set @seq=54000101
declare cur cursor for SELECT sectionid
FROM StudySection
WHERE (yearSemesterID = 2012001)
open cur
fetch next from cur into @c
WHILE @@fetch_status=
begin
set @seq=@seq+1
print @seq
update StudySection set oracleid=@seq where sectionid=@c
fetch next from cur into @c
end
close cur
deallocate cur



本文来源https://www.modb.pro/db/20529

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69953058/viewspace-3139071/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: SQLSERVER去除空白
请登录后发表评论 登录
全部评论

注册时间:2019-11-13

  • 博文量
    566
  • 访问量
    5211