Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Friends,


I want to pass a result set of a procedure into temp table


How can i perform it???


Thanks in Advance

Shreeniwas
Posted

 
Share this answer
 
Comments
CHill60 27-Feb-13 4:56am    
My 5 and now I'm off to read up more about openrowset !
SriNivas IT 27-Feb-13 4:56am    
But I can not use sp_configure proc to change setting can i not do that like


select * from (Exec SP_Name 'p1',p2,'p3')

???
SriNivas IT 27-Feb-13 5:08am    
Actually SP has more than 50 columns and i just want to store this result very short time

Like select * from (select * from Table_Name)

mainly i want to compare result set of 2 SPs whose result set returns 17736 and 17731 rows respectively now i want to intersect result for this only.
hi,

try this coding

make sure temp table columns should same as return recordset of procedure. i.e., field type, no of fields. [ not the field name.]
SQL
create table #temp (id int)

insert  #temp execute sp_test

Select * from #temp

drop table #temp
 
Share this answer
 
Comments
SriNivas IT 27-Feb-13 5:08am    
Actually SP has more than 50 columns and i just want to store this result very short time Like select * from (select * from Table_Name) mainly i want to compare result set of 2 SPs whose result set returns 17736 and 17731 rows respectively now i want to intersect result for this only
Prakash Thirumoorthy 27-Feb-13 5:13am    
if u returning 50 columns, then u have 50 columns in your temp table. and if u want only 2 fields like that, then return that 2 fields only from your sp.
SriNivas IT 27-Feb-13 5:17am    
OK !

But as i say that my problem here is that

sp_1 returning rows 17736

sp_2 returning rows 17731

how i can find out which rows are extra in this huge result

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900