How to "Group by" stored procedure output

How can I group by the output of a stored procedure?

I need to use a stored procedure in a select query and I would like to perform aggregation on its output.
Can I do this?
calloutAsked:
Who is Participating?
 
LowfatspreadConnect With a Mentor Commented:
create table #temp as (COL1 CHAR(1),....)
INSERT INTO #TEMP
 EXEC YOURPROC YOURPARM1,YOURPARM2,...

SELECT ....
  FROM #TEMP
 WHERE ...
GROUP BY ...
0
 
LowfatspreadCommented:
no you can't use a stored procedure in a select...

you can use  a function however...

can you post the stored proc maybe it can be converted into s function?
0
 
Anthony PerkinsCommented:
If you cannot convert it to a function as suggested by Lowfatspread, than the best you can do is resort to inserting the results of the stored procedure into a temporary table.  You can then take that temporary table and do all the aggregation you need.
0
 
calloutAuthor Commented:
Right! :P
Well, how can I collect the output from the stored proc?
0
 
calloutAuthor Commented:
oh der! ;)
(of course)

Thanks heaps for the quick help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.