Stored proc with 2 selects

Answered Stored proc with 2 selects

  • Tuesday, February 12, 2013 8:02 PM
     
      Has Code

    I have inherited this stored proc and was told not to modify any of them if possible. I have never seen this before.

    ALTER   proc [dbo].[sp_GetRequestor]
    @requestor_id int
    as 
    set nocount on 
    -- return requestor recordset 
    select * from 
    tbl_requestor
    where Requestor_id = @requestor_id
    -- return last 3 phone/fax numbers used 
    select * from tbl_requestor_phone_history
    where requestor_id = @requestor_id 
    order by requestor_id, number_type, pid desc 

    This will be used in visual studio 2010 so I am not sure how to retrieve all the data from both selects.

    *** Please allow me to mark threads as answered and I will, Thank you ***

All Replies

  • Tuesday, February 12, 2013 8:09 PM
     
     Answered
    This will be used in visual studio 2010 so I am not sure how to retrieve all the data from both selects

    Hello,

    That's absolute no problem, current data access components can handle multiple result sets; see e.g. Using Multiple Result Sets


    Olaf Helper

    Blog Xing

    • Marked As Answer by ski_freak Tuesday, February 12, 2013 9:04 PM
    •