sqlserver 游标小例

2023-02-17 00:00:00 专区 订阅 付费 交易 评论

总忘,小记

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

相关文章