Pass the Result Set of One Stored Procedure into a Second Stored Procedure as an Input Parameter
Posted on 2013-12-04
As the title says, I need to pass a result set from a stored procedure into another as an input parameter. Here's my situation:
I have a VERY LONG stored procedure that in essence is the heart and soul of my application. It handles one of the most important features of the app. But yeah, it's very long. However it can probably be broken down into two main parts: the part that selects a bunch of data and the part that inserts said data into a bunch of different places.
So I would like to break it apart into 2 stored procedures just to make it a little more palatable for the junior developers who also need to work on it.
The result set amounts to 3 columns of data. I've thought about using a more permanent temp table (I believe @@Temps are permanent until explicitly disposed) in which case I wouldn't even have to pass it as an input parameter I would simply need to reference it.
Anyway, I'm open to suggestions.