Feb 27, 2004 #1 JVZ Programmer Sep 3, 2002 205 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 Mar 26, 2003 772 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 Mar 16, 2001 9,982 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