insert into table1 select * from table2

解决方案 »

  1.   

    我想应该是sql server:
      如果是sql server,insert into table(field1,field2) select field1,field2 from table2
      如果是全部字段,可以像楼上说的。
      vfp:
      sele table1
      appe from table2
      

  2.   

    insert table1 select top 16 * from table2(or a subquery) order by a_ord_col 
      

  3.   

    问题是我没有table2呀
    情况如下:
    table1每增加一条记录,就要在table2里增加16条记录,不想写16次insert table2,怎么办?
      

  4.   

    触发器  or  
      while {boolean}
        begin
        ...
        end
      

  5.   

    oracle:
    create or replace procedure testadd
    is
    begin
    for a in 1..50 loop
    insert into test values ( a, 20);
    end loop;
    end testadd; 
    execute testadd
      

  6.   

    create procedure testadd ( @num int)
    as
    begin
    declare @a int
    select @a=0
    loop1:
    if @a<@num
    begin
    insert into test7 values (@a, 2 , 3 , 4)
    select @a=@a+1
    goto loop1
    endtestadd 16
    插入16条
    end
      

  7.   

    to smae(): 唉,楼上的兄弟写得很辛苦,可肯定不是你想要的。拜托把题说清楚,
    尤其是数据的关系,摆个例表出来不是很好吗?不存在的表也是可以构建出来的,就象
    解几何题的辅助线一样。