Stored procedure with multiple result sets

  • Hello All,

    I am writing some data retrieval stored procedures for a web-based .net app, latest version.

    I am looking for some general guidance on best practices on the pros/cons of my possible solutions.

    Let say I am dynamically populating a web page with a title, some data, and a footnote.

    Example

    Title: Top Three Cities as of 9/30/2011

    Data:

    Chicago-1

    Vancouver-2

    Mexico City-3

    Footnote: *This data was calculated using methodology #1234

    I can think of several ways of writhing this data retrieval procedures.

    1) Three different procedures: uspMyProc1_title, uspMyProc1_data and uspMyProc1_footnote

    2) One procedure, three parameters EXEC uspMyProc1 and then pass one of three parameters: title, data; and footnote.

    3) One procedure, one abstracted result set

    Datatype,City,Ranking,Title,Footnote

    'Title',NULL,NULL,'Top Three Cities as of 9/30/2011',NULL

    'Data',Chicago-1,NULL,NULL

    'Data',Vancouver-2,NULL,NULL

    'Data',Mexico City-3,NULL,NULL

    'Footnote',NULL,NULL,NULL,'*This data was calculated using methodology #1234'

    4) One stored procedure multiple results

    1-I would have to call multiple procedures and manage a lot of procedures

    2-I would have to call multiple procedures

    3-That doesn't seem right

    4-I like this conceptually and I think its possible but I don't see a lot of info on stored procedure with multiple results which makes me think there is some downside here that I am not aware or.

    Any thoughts on this?

  • IMO 4th option is good. I can’t guide you how to handle it in .Net application but my colleagues (front end developers) follow the same approach frequently so I assume it should not be difficult. Please visit .Net forums for more information.

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

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