April 22, 2009 at 1:25 pm
Hi,
Here is the situation. I'd like to run a stored procedure multiple times using sequential table values as inputs.
Simplified, I have a table with ID's, ie:
ID
445
879
349
798
243
So I'd like the SP to run 5 times, first using 445 as the input, then 879, etc. Is there a simple way to do this?
If you think there's a better way to approach this situation, let me know. I'm definitely in the "beginners" class.
Thanks very much for your help.
Kevin
April 22, 2009 at 10:32 pm
One cannot execute sp in s SELECT Statement.
Can you change the SP into Function?
if yes, than it is possible to do it in the SELECT Statement.
Otherwise, CURSORS...
April 23, 2009 at 6:48 am
What is the final goal of this process? Is there any reason why you can't JOIN on your id's table within the stored procedure returning all the rows in one pass? Something like:
Select
columns
From
table AS T JOIN
id_table AS IT ON
T.id = IT.id
Order By
T.id
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 23, 2009 at 7:55 am
Thanks for the replies. I figured out how to remove the parameters from the SP completely, performing the operation in one pass.
While I still think the original functionality could be helpful, looks like its case closed for now.
Thanks again.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply