Interviews2 answers
how can we call the one store procedure with in the anoyher store procedure
Divya Parashar
Posted Dec 13, 2006, 12:02 AM EST2 Answers
An Easy example:
CREATE PROCEDURE prcCallprc
(
Exec prcCalledPrc
)
Go
EXEC prcCallprc
ThamizhJainPosted Aug 30, 2008, 2:42 AM EDT
'This stored procedure is called by a business component or webpage
'passing into two parameters, executes sp_ChildStoredProc and passes on value.
'The @Id OUTPUT returns the value.
CREATE PROCEDURE sp_ParentStoredProc
(
@col1 varchar(20)
@ValuePassed varchar(50),
)
AS
declare @Id int
EXEC sp_ReturnValue @ValuePassed, @Id OUTPUT
INSERT INTO SomeTable
(col1, col2)
VALUES
(@col1, @Id)
RETURN
GO
'passing into two parameters, executes sp_ChildStoredProc and passes on value.
'The @Id OUTPUT returns the value.
CREATE PROCEDURE sp_ParentStoredProc
(
@col1 varchar(20)
@ValuePassed varchar(50),
)
AS
declare @Id int
EXEC sp_ReturnValue @ValuePassed, @Id OUTPUT
INSERT INTO SomeTable
(col1, col2)
VALUES
(@col1, @Id)
RETURN
GO
canujaPosted Dec 15, 2006, 11:29 PM EST
