shyamaladevib
asked on
nested stored procedure(sp2) within a stored procedure1(sp1) to use the output of sp2 as an input to sp2
Hi experts,
I have to create a stored procedure which has a nested stored procedure within, the structure should look like:
CREATE PROCEDURE SP1
@params int,
AS
BEGIN
SELECT col1, col2 ... coln
FROM yourTable
WHERE somecolumn = @params;
END;
CREATE PROCEDURE SP2
select c1,c2 from table
The output column c2 of of SP2 should be the input @params of SP1,
should I write a cursor to achieve this or should it be a nested procedure? please help me with the sql for this.
The @params will get multiple values and which are passed through the SP1 to achieve results, not sure if I am clear, please let me know of any questions.
Thanks!
I have to create a stored procedure which has a nested stored procedure within, the structure should look like:
CREATE PROCEDURE SP1
@params int,
AS
BEGIN
SELECT col1, col2 ... coln
FROM yourTable
WHERE somecolumn = @params;
END;
CREATE PROCEDURE SP2
select c1,c2 from table
The output column c2 of of SP2 should be the input @params of SP1,
should I write a cursor to achieve this or should it be a nested procedure? please help me with the sql for this.
The @params will get multiple values and which are passed through the SP1 to achieve results, not sure if I am clear, please let me know of any questions.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER