eg:1:   Create procedure test
   As
     Select 1 as id,'abc' as name 
  go2:
 Create table #tmp (a int,b varchar(10))
 insert #tmp Exec test
 Select * from #tmp
  

解决方案 »

  1.   

    注意必须先建临时表,再用insert #tmp Exec test
      

  2.   

    select  *  into  #Tmp  from  A 
    即可
    #tmp為臨時表
    A 可為查詢聚合(暫是看作一個表,可以自由發展)
      

  3.   

    Create procedure test
       As    
       Select  *  into ##temp from table1
      go在外面你就可以访问##temp表了
      

  4.   

    create table #a(spid int,ecid int,status varchar(50),loginname varchar(50),hostname varchar(50),blk int,dbname varchar(50),cmd text)
    insert into #a exec('sp_who')
      

  5.   


    你可以运行这个例子看一下,它将sp_who存储过程返回的记录集插入到临时表中
    create table #a(spid int,ecid int,status varchar(50),loginname varchar(50),hostname varchar(50),blk int,dbname varchar(50),cmd text)insert into #a exec('sp_who')
      

  6.   

    举例:
    create table #a(a varchar(1000))insert #a exec xp_cmdshell 'dir c:'select * from #a
      

  7.   

    create table #temp (col1 varchar(100),col2.........)insert into #temp exec proc_name