exec 'SELECT * INTO ##TABLE_TEMP FROM .......'

解决方案 »

  1.   

    create proc T_PC
    as 
    select * from A
    insert A1 exec T_PC注意 : A 与 A1 的表结构必须一样
      

  2.   

    定义一个Table类型的变量,存储过程返回即可!
      

  3.   

    搞定!!哈哈,谢谢scmail81(琳) 和各位!create table #tb (Text varchar(1000) )
    insert   #tb  exec sp_helptext 'upTeachersDel'
    select * from #tb
    drop table #tb
      

  4.   

    create procedure sp_test
    as
    select 1 ,10 union
    select 1 ,20 union
    select 1 ,30 union
    select 1 ,40 
    godeclare @t table (id int, num int)--不能直接将exec 存储过程的返回记录集追加到表变量中--生成一个临时表
    select *
    into #tp
    from @t--把存储过程返回的记录集先追加到临时表中
    insert into #tp(id, num)
    exec sp_test--将临时表中的数据追加到表变量中
    insert into @t(id, num)
    select *
    from #tpselect * from @tdrop procedure sp_test
    drop table #tp
    go