declare @i int
declare @a int
declare @b int
set @i=0
while(@i<=20)
begin
set @a=@i*1000+1;
set @b=1000*(@i+1);
insert into DYQJYZJ..djsj1(djbh,fwbm,sjsj,sjlx,sjmc,sjimage,sjsl,sjsybz,syewsj,sfbcsj,ys,bz,[type],neworold,yq)
select djbh,fwbm,sjsj,sjlx,sjmc,sjimage,sjsl,sjsybz,syewsj,sfbcsj,ys,bz,[type],neworold,yq from djsj1 where sjbh between @a and @b
select @i=@i+1
print @i
print 'id:'+convert(varchar(50),@a)+'---'+convert(varchar(50),@b)
end