Calling another Proc for Multiple Rows

  • Hi there, Is there anyway to call a stored procedure for multiple data rows. For example: We have proc A, that generates a temp table that has 20 records.

    Proc A needs to call proc B and perform proc B for each of the 20 records in it's temp table.

    Right now we use cursors to loop over the temp table and call proc B for each record in temp table.

    I was just wondering if there was some sort of way to call proc B in one pass with all the data from the temp table.

    Something like this

    Insert Into Proc B From TempTable_ProcA

    Basically we're trying to avoid using cursors if possible, and Proc B is somewhat complex so incorporating it in Proc A would be difficult.

    By the way, this is a great site. I think I'm out here almost everyday.

  • Put the data in a Global temp table and B will be able to see as well as any other process. Or create a physical table thru A and allow B to do it's work there. Or post your code and it may be possible someone could see a better way to deal with.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

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

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