locked
Stored Procedure returning multiple result sets from other called stored procs RRS feed

  • Question

  • User2050628842 posted

    I have a stored procedure (Proc A) that opens a cursor and does some work for each record in the cursor. As part of the work that it does, it calls another stored procedure (Proc B) and increments an INT variable in Proc A so that I can return the count when the work is done. The problem is that the second stored procedure returns data as well for use in other areas of the system. In my case, I don't need any of the data that is being return from Proc B. The problem is that I am calling Proc A using Execute Scalar because I only need the count value. However, the result set is containing all the junk from Proc B since that selects data as well. Since the data being returned in Proc B is not correct the application throws an exception when it returns a date and expects an integer.

     So, basically, I need a way to entirely ignore or clear out anything returned by Proc B, so I only get what Proc A is trying to return.

    Monday, July 21, 2008 3:14 PM

Answers

  • User848370396 posted

    So, basically, I need a way to entirely ignore or clear out anything returned by Proc B, so I only get what Proc A is trying to return.

    I think it's not possible.

    if you don;t want to get the other data from procB,  

      add a flag parameter to the stored procecdure procB, in that stored procedure procB, if that flag is equal to 1, then only execute the select statement. otherwise don;t execute. now if you wants to get data from that procedure, pass any value other than 1, if not pass only 1.

     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 22, 2008 1:13 AM