Given a stored procedure in SQL Server which has multiple select statements, is there a way to work with those results separately while calling the procedure?>
Would passing a parameter to the sp do the trick
----------------------
CREATE PROCEDURE dostuff @parm1 int
AS
BEGIN
Declare @resultset Int
Set @resultset = @parm1
--0 = Select ranks
--1 = Select suits
--other - Select ALL
If @resultset = 0
SELECT [rank] FROM [ranks]
Else If @resultset = 1
SELECT [suit] FROM [suits]
Else
SELECT * FROM [suits]
cross join [ranks]
END
GO
declare @mytemptbl table (rank text)
insert @mytemptbl
exec dostuff 0
select * from @mytemptbl