Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Join two stored procedure outputs

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2006-01-09 : 13:59:10
How can I join two outputs of stored procedures in one select statement?

i.e)

Exec SP1
Join
Exec Sp2


druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-01-09 : 15:03:56
Create table #temp1 (blah -blah -blah)
Create table #temp2 (blah -blah -blah)

insert into #temp1
exec sp1

insert into #temp2
exec sp2

select f1, f2, f3 whatever
from #temp1 inner join #temp2 on whatever
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-10 : 01:22:23
You cant directly join the resultset of two or more stored procedures
The only way is to use temp tables and do union all

select columns from #temp1
union all
select columns from #temp2


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -