Feb 27, 2004 #1 JVZ Programmer Joined Sep 3, 2002 Messages 205 Location CA Hello All - I was wondering if the below query is possible? SELECT tDate, rCount FROM (EXEC usp_someSP) GROUP BY tDate
Hello All - I was wondering if the below query is possible? SELECT tDate, rCount FROM (EXEC usp_someSP) GROUP BY tDate
Feb 27, 2004 #2 ClaireHCM IS-IT--Management Joined Mar 26, 2003 Messages 772 Location US Unfortunately, not possible. But if you could combine the logic of the query alone with the stored procedure to make another stored procedure is also not a bad idea. Upvote 0 Downvote
Unfortunately, not possible. But if you could combine the logic of the query alone with the stored procedure to make another stored procedure is also not a bad idea.
Feb 27, 2004 #3 tlbroadbent MIS Joined Mar 16, 2001 Messages 9,982 Location US You can insert the result set of a stored proc into a temporary table. Then select from the table. Create Table #temp(Tdate datetime, rCount int) INSERT #temp EXEC usp_someSP SELECT tDate, Tot=Sum(rCount) FROM #temp GROUP BY tDate Drop Table #temp If you want to get the best answer for your question read faq183-874 and faq183-3179. Terry L. Broadbent - DBA SQL Server Page: http://tlbroadbent.home.comcast.net/sql/sql_articles.htm Upvote 0 Downvote
You can insert the result set of a stored proc into a temporary table. Then select from the table. Create Table #temp(Tdate datetime, rCount int) INSERT #temp EXEC usp_someSP SELECT tDate, Tot=Sum(rCount) FROM #temp GROUP BY tDate Drop Table #temp If you want to get the best answer for your question read faq183-874 and faq183-3179. Terry L. Broadbent - DBA SQL Server Page: http://tlbroadbent.home.comcast.net/sql/sql_articles.htm