sql循环分条更改数据
declare @bianliang int ;
set @bianliang =1
DECLARE @b varchar(100)
DECLARE @c varchar(100);
begin -----循环更改数据库中的表数据
while @bianliang<21
begin
select top(1) @b = gg from abce where bh not in (select top(@bianliang-1) bh from abce order by bh) order by bh
select top(1) @c = bh from abce a where bh not in (select top(@bianliang-1) bh from abce order by bh) order by bh
update JD_ZCTZ set JD_ZCTZ.ggxh=@b where JD_ZCTZ.kpbh = @c
set @bianliang=@bianliang+1
continue
end
end