如何在存储过程中调用存储过程并获取值

问题描述:

我正在使用存储过程,我想在存储过程中调用另一个痛苦的过程.被调用的过程将返回一些输出值,并且在我的代码中没有重现.请帮助我.代码在下面提到.

ALTER PROCEDURE [dbo].[Generate_Cust_RequestDetails]
-从应用程序传递参数
@pFran varchar(2),
@pBrch varchar(5),
@pWhse varchar(2),
@pDocNo Varchar(10),
@pCust Varchar(10),
@pBrandValue varchar(2),
@pPriceType varchar(4),
@pPricingGroup varchar(10)
AS
开始
声明@lsPart char(28)
声明@lsFinalPart char(28)
执行dbo.Parts_GetPartNSubsDetails @ pFran,@ lsFinalPart
END

@lsFinalPart是输出值,但始终为空白.

通过调试,我发现调用的存储过程中没有错误.

I am having stored procedure and i would like to call another sotred procdure with in the stored procedure. Called procedure will return some output values and in my code it is not returing. Kindly help me. Code is mentioned below.

ALTER PROCEDURE [dbo].[Generate_Cust_RequestDetails]
-- Parameter passing from Application
@pFran varchar(2),
@pBrch varchar(5),
@pWhse varchar(2),
@pDocNo Varchar(10),
@pCust Varchar(10),
@pBrandValue varchar(2),
@pPriceType varchar(4),
@pPricingGroup varchar(10)
AS
BEGIN
declare @lsPart char(28)
declare @lsFinalPart char(28)
execute dbo.Parts_GetPartNSubsDetails @pFran,@lsFinalPart
END

@lsFinalPart is the output values but always coming as blank.

by going debug and i found there is no bug in the called stored procedure.

Try:
Try:
execute dbo.Parts_GetPartNSubsDetails   @pFran,@lsFinalPart OUTPUT