Multiple Result Sets

  • I am building some monitoring tools based on Steve's series of articles "Automatically Gathering Server Information". One of the things I am doing is gathering database info using the sp_helpdb procedure.

    If I execute sp_helpdb without specifying a database, I can put the results into an empty table. What I want to do, however, is get the second result set from executing sp_helpdb and specifying a specific database.

    Does anyone know of any way to get the results of a stored procedure that returns multiple result sets, into a table (or tables)?

    ----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011

  • I would suggest to execute sp_helptext on sp_helpdb to get the source code for sp_helpdb. Then look for the part of the code that is generating the second result set and use it.

  • quote:


    What I want to do, however, is get the second result set from executing sp_helpdb and specifying a specific database.


    You can get second result set of sp_helpdb by running sp_helpfile.

  • Are you looking for a pure TSQL solution, or would code work too?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • I was looking for a pure TSQL solution.

    I've ended up using the sp_helpfile idea. (Thanks Allen_Cui.)

    I just finished running a test with this code in place. It's working like a charm. I was just unaware of this procedure.

    Once again, sqlservercentral.com comes to the rescue.

    Thanks for all your help.

    ----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011

  • hi

    Is there a way in t-sql to retrieve the results set of the second table of sp_helpdb [dbname]. I also am putting together DB info in a number of instances. So I either need to:

    1) put sp_helpdb in a cursor with the db name as a parameter if I can get the results of the 2nd result set.

    2) get the same results by executing an sp like sp_helpfile which accepts parameters. Any ideas ?

    Regards

Viewing 7 posts - 1 through 6 (of 6 total)

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