利用游标遍历表,更新表记录
declare @Id bigint
declare @count int
declare @eventIDvarchar(50)
set @Id = 4294967297
declare my_Cursorcursor local for
select EventCodefrom eventRule
open my_Cursor
while @@FETCH_STATUS= 0
begin
fetch next from my_Cursor into @eventID
update EventRule set ID = @Id where EventCode= @eventID
set @Id = @Id + 1
end
close my_Cursor
deallocate my_Cursor