我用一个储存过程 怎样把储存过程返回的记录集插入到另一张表中呢,

解决方案 »

  1.   

    办法很多,用临时表,物理表都可以,把返回的数据直接插入就可以阿,看表结构了,
    用select * into #tb1 from tb2 ,把sql写成动态的 
      

  2.   

    我的意思是我要写个储存过程,目的是把从另外的储存过程返回的记录集插入到一张表中,就是说 insert table(....) select ....from 储存过程。
      

  3.   

    insert into table(....) 
    exec 存储过程
      

  4.   

    insert into table(....) 
    exec 存储过程
      

  5.   

    nsert into table(....)  select @i ,...
    其中@i为存储过程的返回值
      

  6.   

    例如:
    select * into #temp
    from devinsert into #temp
    exec test
      

  7.   


    insert into table(....) 
    exec 存储过程用中间表把相应的记录插完。。之后drop
      

  8.   

    CREATE   PROCEDURE PROC_CREATE_USER
    @NAME nvarchar(20);
    @Addr nvarchar(20);select * 
    into #Tmp
    from TALBE1 where Name=@NAME or Addr=@Addrinsert into TABLE2 (Name)
    select name from #tmpGO
    大概的思想就是如此了.