January 19, 2011 at 8:08 am
I have a stored procedure that calls another stored procedure that returns two record sets. If I retrieve the results into a table variable, I get both result sets in the table with no way to separate them.
Is there any way to process the two sets separately or will I have to break the called procedure into two separate procedures?
I went all through BOL and found nothing on this topic.
Thanks for any help,
Liz
January 19, 2011 at 8:25 am
Can you add a parameter for returning one result set or the other to the sp that's being called?
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
January 19, 2011 at 8:31 am
I need both result sets, but I need a way to separate them in the receiving procedure.
January 19, 2011 at 8:35 am
sing4you (1/19/2011)
I need both result sets, but I need a way to separate them in the receiving procedure.
If there is a reason to return both sets at once (such as performance), then an alternative to distinguish each set is to simply add a column to the result set that designates which set each one is. For instance a column named "SetNo" and only contains a "1" or "2". Does that make sense?
p.s., The only reason I can think of to return both sets at once is that there is overlap in creating the sets, so it helps performance.
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
January 19, 2011 at 8:46 am
Yes! That totally makes sense. I just tried it and it worked!!! Thanks 😀
January 19, 2011 at 8:50 am
You're welcome. 'Glad I could help. 🙂
The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. - Stephen Hawking
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply