Hi all,
I have a stored procedure which returns 1 or 2 rows. No more than 2.
I have a table which I want to pass a value to the stored proc for every row in the table. My table only has about 30 or 40 rows.
Each time the stored proc runs with the current table.field value, I want the output in a temp table so eventually it will build up to contain all the stored proc results for each value in the table.
I am doing
INSERT INTO #MyTable EXEC MyStoredProc
which works excellently, thanks to a prior post on this issue - thanks vongrunt.
What I also need is the table.field value on the same row in #MyTable getting populated by the stored proc results.
What I already have is
<loop thru table>
@MyVariable = table.field
INSERT INTO #MyTable (@MyVariable, EXEC MyStoredProc)
but this is obviously the wrong syntax coz it aint working.
How can I do it?
BEGIN
I have a stored procedure which returns 1 or 2 rows. No more than 2.
I have a table which I want to pass a value to the stored proc for every row in the table. My table only has about 30 or 40 rows.
Each time the stored proc runs with the current table.field value, I want the output in a temp table so eventually it will build up to contain all the stored proc results for each value in the table.
I am doing
INSERT INTO #MyTable EXEC MyStoredProc
which works excellently, thanks to a prior post on this issue - thanks vongrunt.
What I also need is the table.field value on the same row in #MyTable getting populated by the stored proc results.
What I already have is
<loop thru table>
@MyVariable = table.field
INSERT INTO #MyTable (@MyVariable, EXEC MyStoredProc)
but this is obviously the wrong syntax coz it aint working.
How can I do it?
BEGIN