小弟只知道 insert into 
这样一次插一条听说可以 和select 配合 ; 一次插入多条~请问怎么做到的举个例子~谢谢前辈

解决方案 »

  1.   

    INSERT TB 
    SELECT 1 UNION ALL
    SELECT 2 ....
      

  2.   

    insert into tba(a,b,c)
    select c,d,e from tbb where ...
      

  3.   


    insert into @b select * from @a
      

  4.   

    INSERT TB 
    SELECT 1 ,3 UNION ALL
    SELECT 2 ,2 UNION ALL
    select 3 ,5
      

  5.   

    --从其他表 批量数据过来
    insert 表
    select * from 数据表
      

  6.   


    insert into table
    结果集
      

  7.   

    declare @table1 table(id int)
    insert into @table1 select 
    1 union all select 
    2 union all select
    3 union all select
    3
    select * from @table1id
    -----------
    1
    2
    3
    3(4 行受影响)
    如果是union select 则会自动去掉重复declare @table1 table(id int)
    insert into @table1 select 
    1 union select 
    2 union select
    3 union select
    3
    select * from @table1
     
    id
    -----------
    1
    2
    3(3 行受影响)