Executing a Stored Procedure with different parameters

  • Hi there,

    I am trying to create a report using Stored Procedures from an existing software system (I don't have access to the DB and I can't update the stored procedures).

    I have a Stored Proc that retrieves data based on one parameter. For example, if you specify a person's name, it gives you all of their address information.

    The problem is that I need to execute the Stored Proc for all of the names in the system!

    From another stored procedure, I am able to retrieve all of the Names in the system and display them in a column in the table. Now I want to add a second column with the address information.

    It seems like I somehow have to get the stored procedure to execute for every row.

    1) Is there a better way to do this without making tons of calls to the db?

    2) If not, how do I even get the stored procedure to run for every row? Using some kind of lookup?

    Thanks again!

  • tigerlilly_783 (12/14/2011)


    It seems like I somehow have to get the stored procedure to execute for every row.

    1) Is there a better way to do this without making tons of calls to the db?

    2) If not, how do I even get the stored procedure to run for every row? Using some kind of lookup?

    You do, if you don't change the code. Which means this:

    I am trying to create a report using Stored Procedures from an existing software system (I don't have access to the DB and I can't update the stored procedures).

    Hampers your options.

    1) Not without re-writing.

    2) Try using it as a subreport, with the names as the main report and fed to the query/proc feeding the subreport. A little formatting and you can make it invisible to the user.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks so much Craig!!!

    It works! 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply