在另一个存储过程中执行存储过程 [英] execute Stored Proc inside another Stored Proc

查看:112
本文介绍了在另一个存储过程中执行存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有两个存储过程,我想在第二个存储过程中执行第一个存储过程并获得结果集。



这在SQL 2005中是否可行?



谢谢。

解决方案

是可能的。





 创建  PROCEDURE  FIRSTPROC 
AS
BEGIN
SET NOCOUNT ON
EXEC SECONDPROC
SET NOCOUNT OFF
END






试试这个,



http://www.mssqltips.com/sqlservertutorial/163/returning- stored-procedure-parameter-values-to-call-stored-procedure / [ ^ ]


< blockquote>感谢您的所有解决方案,但它不起作用。



我找到了一个很好的解决方案:



  insert   into  #table_temp 
exec [ap_StoreProc] @ Param1 ;


Hi,

I have two Stored Procs, I want to execute the first Stored Proc inside the second Stored Proc and get the resultset.

Is this possible in SQL 2005?

Thank you.

解决方案

YES Its possible.


CREATE PROCEDURE FIRSTPROC
AS
BEGIN
    SET NOCOUNT ON
        EXEC SECONDPROC
    SET NOCOUNT OFF
END


Hi,

Try this ,

http://www.mssqltips.com/sqlservertutorial/163/returning-stored-procedure-parameter-values-to-a-calling-stored-procedure/[^]


Thanks to all your solution but it doesnt work.

I found a good solution:

insert into #table_temp
    exec [ap_StoreProc] @Param1;


这篇关于在另一个存储过程中执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆