【问题标题】:Capture Return Value of Stored Procedure from Within Another Stored Procedure从另一个存储过程中捕获存储过程的返回值
【发布时间】:2014-02-27 21:13:36
【问题描述】:

我正在从另一个存储过程中调用一个存储过程。我在 SP1 中指定了一些返回值(整数)。我想从 SP2 中调用 SP1 并能够捕获这些返回值(并根据它们的内容执行操作)。我该怎么做?

【问题讨论】:

标签: sql-server stored-procedures


【解决方案1】:
CREATE PROCEDURE  UPS_2
@Var1 Datatype,    --<-- Variables you need to execute SP1
@Var2 Datatype,
@Var3 Datatype     --<-- Also Variables you need to execute this proc
AS
BEGIN
 SET NOCOUNT ON;

 DECLARE @Rtn_Var Datatype;  

  EXECUTE @Rtn_Var = dbo.SP1 @Var1

  /* Now you can use returned Values from SP1 Inside this proc */


  /* Do other cool stuff here  */

END

【讨论】:

    猜你喜欢
    • 2011-04-26
    • 1970-01-01
    • 1970-01-01
    • 2018-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多