declare @a int
set @a=1390100
while @a<=1390800 begin 
insert 表 select @a
set @a=@a+1
end

解决方案 »

  1.   

    declare @start int
    declare @end int
    set @start = 100
    set @end = 800while ( @start <= @end )
    begin
    insert into t
    select '1390' + cast( @start as varchar( 3 ) ) @start = @start + 1
    end
      

  2.   

    declare @s table(sid varchar(7))
    declare @t table(id int identity(100,1),c int)set rowcount 701
    insert into @t select 1 from sysobjects a,sysobjects b
    set rowcount 0insert into @s select rtrim(1390000+id) from @t order by idselect * from @s
      

  3.   

    declare @t1 table (col varchar(7))
    select top 701 rowid = identity(int,100,1) into #t from sysobjects a,sysobjects b
    select * from #tinsert into @t1 select '1390'+convert(char(3),rowid) from #t
    select * from @t1
    drop table #t
    /*
    col     
    ------- 
    1390100
    1390101
    1390102
    1390103
    1390104
    1390105
    1390106
    1390107
    1390108
    1390109
    1390110
    1390111
    1390112
    1390113
    1390114
    1390115
    1390116
    1390117
    1390118
    1390119
    1390120
    1390121
    1390122
    1390123
    1390124
    1390125
    1390126
    1390127
    1390128
    1390129
    1390130
    1390131
    1390132
    1390133
    ....
    1390800
    */
      

  4.   


    create table #Num(
      hand_num  varchar(20) null
    )
    declare @i int
    set @i = 1
    while @i <=701 
    begin
      insert into #Num values(1390099+@i)
      set @i = @i + 1
    end
    select * from #Num
    drop table #Num