--申明一个游标
DECLARE MyCursor CURSOR
FOR
select Code from SYS_SyncPushToBase where ObjectVersion='批次号'
--打开一个游标
OPEN MyCursor
--循环一个游标
DECLARE @Code int ,
@Id int
set @Id=1
FETCH NEXT FROM MyCursor INTO @BusinessCode, @BusinessName
WHILE @@FETCH_STATUS =0
BEGIN
update SYS_SyncPushToBase set ObjectVersion=@Id where Code=@Code
set @Id=@Id+1
FETCH NEXT FROM MyCursor INTO @BusinessCode, @BusinessName
END
--关闭游标
CLOSE MyCursor
--释放资源
DEALLOCATE MyCursor