declare @id int
declare @addTime datetime
declare cursor1 cursor for --定义游标cursor1
select id,addtime from MR_Examine --使用游标的对象(跟据需要填入select文)
open cursor1 --打开游标
declare @i int
set @i=1
fetch next from cursor1 into @id,@addTime --将游标向下移1行,[email protected],@name中


while @@fetch_status=0 --判断是否成功获取数据
begin
if(@i>10)
set @i=1

update MR_Examine set AddTime=DATEADD(DAY,@i*-1,GETDATE()) where [email protected] --进行相应处理(跟据需要填入SQL文)
set @[email protected]+1
fetch next from cursor1 into @id,@addTime --将游标向下移1行
end
close cursor1 --关闭游标
deallocate cursor1