Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Handling multiple resultsets returned from Stored Procedure

Mar 20 2013 12:00AM by Madhivanan   

One of my friends asked me if it is possible to load multiple resultsets returned from a stored procedure into a temporary table for some analysis purpose. The answer is "It depends". If all the resultsets return same number of columns then it is possible. Consider the following stored procedure

create procedure proc_testing
as
select 345 as number
select 52345 as number
select 1200 as number

Executing this procedure will give three resultsets  Now create a temporary table
create table #temp(number int)
Add data to this table by executing the stored procedure
insert into #temp(number) 
exec proc_testing

Check the result from the table
select * from #temp

The result is
number
-----------
345
52345
1200
Note: Currently it is not possible to identify a specific resultset from the stored procedure.

Tags: 


Madhivanan
2 · 40% · 12993
15
 
0
Lifesaver
 
 
 
0
Incorrect



Submit

6  Comments  

  • Nice article, just would like to add one more condition that if you have multiple result sets then not only the columns should be same but also the data type should be compatible.

    Imran

    commented on Mar 20 2013 2:15AM
    mimran18
    1622 · 0% · 12
  • Thanks mimran18. Thats a good point

    commented on Mar 20 2013 4:00AM
    Madhivanan
    2 · 40% · 12993
  • HI Madhivanan,

    I think its following the UNION ALL principle.

    Please correct me if i am wrong.

    Thanks

    commented on Mar 20 2013 4:36AM
    Bala Krishna
    83 · 2% · 676
  • Nice article... I thought it insert only first table record. but it insert all tables record. Limitation is that data type and number of column should be same.

    commented on Mar 21 2013 12:35AM
    riks
    1014 · 0% · 26
  • There is another way to handle multiple result sets in procedure, it available in SQL 2012. http://raresql.com/2012/07/02/sql-server-2012-executing-stored-procedure-with-result-sets/

    commented on May 9 2013 2:19AM
    antonsc229
    2036 · 0% · 9
  • nice article

    commented on Feb 26 2014 5:34AM
    sangappa
    2873 · 0% · 3

Your Comment


Sign Up or Login to post a comment.

"Handling multiple resultsets returned from Stored Procedure" rated 5 out of 5 by 15 readers
Handling multiple resultsets returned from Stored Procedure , 5.0 out of 5 based on 15 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]