I have a stored proc that return multiple result sets, and it works perfectly fine. However, I'm writing unit tests for this proc, and so I need to call this from another stored proc. I've handled these multiple result sets in my code by using SqlDataReader.NextResult(). Is there something on these lines in SQL Server that would allow me to do the same from within the calling stored proc? Even before I iterate through the result-sets, there should be a way to store them as well.
Asked
Active
Viewed 753 times
1
-
You may find some helpful information in [this](http://stackoverflow.com/questions/10130276/how-to-select-temp-table1-subselect-1-temp-table2-subselect-2-from#comment12985560_10130276) SO post. – HABO Apr 19 '12 at 15:12
-
@user92546 Seems like the mentioned SO post is more about accessing the result sets from a programming language, what I'd like to do is access them from within SQL Server itself. – neuDev33 Apr 19 '12 at 15:21
-
1You can capture the resultset from a SP using [insert into ... exec SP](http://msdn.microsoft.com/en-us/library/ms174335.aspx). If you have two resultsets both columns sets must match column set of the target table. Both resultsets will end up in the same table. – Mikael Eriksson Apr 19 '12 at 15:23
-
@neuDev33 - The OP of the post I referenced clarified "I would like to do implement this functionality as pure TSQL." It doesn't sound promising. – HABO Apr 19 '12 at 15:24