Running Stored Procedure with Input Parameters from Table

  • 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

  • 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...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • 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

  • 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