Subject | Syntax for input arguments for Stored Procedure from SELECT |
---|---|
Author | vladman992000 |
Post date | 2010-06-03T18:56:59Z |
I'm not sure how to construct this in a query, but I have a stored procedure that does some processing on data in a table, and returns back some results. The input argument to it is the primary key to the table.
I need to call it in another stored procedure, but send in the result of a SELECT statement to it, and then return all the resulting data back from this 'master' stored procedure.
I was thinking that this is generally a 'nested select' statement, where the result of one select query becomes the criteria for another. However as I only know how to do that within a WHERE clause, and in this case I need the result set from a sub-query to be the input arguments to a stored procedure, I'm lost.
I know this won't work, but hopefully it will demonstrate what I'm trying to achieve so someone could put me on the right path:
SELECT * FROM PROCESSING_SP(
SELECT ID FROM TABLE WHERE ID > 100);
What is the correct syntax for doing this sort of thing in a stored procedure input argument set?
Myles
I need to call it in another stored procedure, but send in the result of a SELECT statement to it, and then return all the resulting data back from this 'master' stored procedure.
I was thinking that this is generally a 'nested select' statement, where the result of one select query becomes the criteria for another. However as I only know how to do that within a WHERE clause, and in this case I need the result set from a sub-query to be the input arguments to a stored procedure, I'm lost.
I know this won't work, but hopefully it will demonstrate what I'm trying to achieve so someone could put me on the right path:
SELECT * FROM PROCESSING_SP(
SELECT ID FROM TABLE WHERE ID > 100);
What is the correct syntax for doing this sort of thing in a stored procedure input argument set?
Myles