1 set rowcount 0 2 select NULL mykey, * into #mytemp from dbo.DIM_DISTRIBUTOR 3 4 set rowcount 1 5 update #mytemp set mykey = 1 6 7 declare @i int 8 set @i=1 9 while @@rowcount > 0 10 begin 11 set rowcount 0 12 select * from #mytemp where mykey = 1 13 14 declare @zj varchar(222) 15 select @zj=DISTRIBUTORID from #mytemp where mykey = 1 16 print @i 17 18 update DIM_DISTRIBUTOR set NAME=‘用户测试数据‘+CAST(@i as varchar(222)) where DISTRIBUTORID=@zj 19 20 set @i=@i+1 21 delete #mytemp where mykey = 1 22 set rowcount 1 23 update #mytemp set mykey = 1 24 end 25 set rowcount 0