declare @int 
set @i=1
while @i<=1000
begin
 insert 表(id,name,type)
  values(@i,'a','b')
  set @i=@i+1
end

解决方案 »

  1.   

    Declare @id int
     set @id=1
    while @id<=1000
     begin
       Insert Into table
       Select @id,'a','b'   set @id=@id+1
     end
      

  2.   

    若id字段为标识列:insert 表(name,type)
    select top 1000 'a','b' from master.dbo.syscolumns a,master.dbo.syscolumns b
      

  3.   

    若你的表中id不是自增的:
    select top 1000 identity(int,1,1) id into #t from sysobjects a,sysobjects b
    insert into table1(id,name,type)
      select id,'a','b' from #t
    drop table #t若你的表中id是自增的:
    insert into table1(name,type)
      select top 1000 'a','b' from sysobjects a,sysobjects b
      

  4.   

    select top 1000 identity(int,1,1) id into #t from sysobjects a,sysobjects b
    insert into table1(id,name,type)
      select id,'a','b' from #t
    drop table #t
      

  5.   


    若id非标识列:set nocount on
    declare @int 
    set @i=0
    while @i<1000
    begin
     insert 表(id,name,type)
    select @i=@i+1,'a','b'
    end
    set nocount off
      

  6.   

    首先保証一個表超過1000條記錄,用下面語句我覺得最好insert 表(name,type)
    select top 1000 'a','b' from syscolumns