在存储过程中,怎么把select得到的记录结果,再插入其它表中?

解决方案 »

  1.   

    create  proc  test  as
    insert into b 
    select *  from  a
    go
      

  2.   

    一楼正解
    select .. into也可以但是不适于重复插入
      

  3.   

    CREATE PROCEDURE proc_checkuserinfo 
    AS
    if not exists(select * from qqinfo where (convert(varchar(10), getdate(), 8) < convert(varchar(10), dStartDate, 8)) and  iQQ in (select iQQId from qqstatus where iflag = 0 and iStatus <> 1) and iQQ not in(select iQQ from qqaction))
    begin
    .....(需要把上面select的结果,放入另外一个表中,能解释下吗)
    end
    GO