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