首页 > 数据库 > > sqlserver 游标小例
总忘,小记
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/ ,如需转载,请注明出处,否则将追究法律责任。