向数据库里插入多行数据怎么写

解决方案 »

  1.   

    循环插入100条记录:
    declare @bb int 
    set @bb=1
    while @bb<100
    begin
       insert into table1 values(@bb,....)
       set @bb=@bb+1
    end
      

  2.   

    insert into yourtable (select yourfield from yourothertable)
    或者
    insert into yourtable (1,2,3,4)
    (select 5 as 1,6 as 2,7 as 3,8 as 4 from yourothertable)
    或者
    insert into yourtable (1,2,3,4)
    (select 5 as 1,6 as 2,7 as 3,8 as 4 from yourothertable
    unoin
    select 5 as 1,6 as 2,7 as 3,8 as 4 from yourothertable
    unoin
    select 5 as 1,6 as 2,7 as 3,8 as 4 from yourothertable
    .......
    )
    看一看这些符合你的要求吗?)