nested stored procedure(sp2) within a stored procedure1(sp1) to use the output of sp2 as an input to sp2
Posted on 2010-11-30
I have to create a stored procedure which has a nested stored procedure within, the structure should look like:
CREATE PROCEDURE SP1
SELECT col1, col2 ... coln
WHERE somecolumn = @params;
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.