Second resultset of stored procedure into a temp table - also, what's the best way to flay a develoer?

  • I'm working on building a report and asked a developer which table some data comes from in an application. His answer was the name of a 3500 line stored procedure that returns 2 result sets. I could accomplish what I'm trying to do using the second result set, but I'm not sure how to put that into a temporary table so that I could use it.

    I figured I'd see if anyone here has approached this issue.

    Here's my plan according to the Kübler-Ross software development lifecycle:

    Denial - Ask the developer to make sure this is correct (done)

    Despair - Look hopelessly for a solution (where I am now)

    Anger - Chastise developer

    Bargaining - See if I can get him to at least swap the order that the resultsets are returned

    Acceptance - Tell the users that this can't be done at present.

    If someone knows how to get to that second resultset, I would appreciate not having to move on the third step.

  • Honestly, I'd probably kludge this one if possible.

    See if you can add an optional flag as a parameter to the proc to indicate that the first result set is not to be returned, only the second. Then you can capture the output from the proc directly into a temp table, for example, since it will then be only one result set.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • You know, I never even thought of that! It's already going to be a kludge, so something a bit kludgier isn't going to make things that much worse. Thank you for the idea!

  • You're welcome! At least you don't need to change much of 3500 lines of code :-).

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

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

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