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.
| Author |
Topic |
|
Bryce Covert
Starting Member
12 Posts |
Posted - 2005-07-08 : 13:54:11
|
| Is it possible to union two stored procedures results? IEExec storedprocedure1 'a'Exec storedprocedure1 'b'and have these results unioned together somehow?Thanks!Bryce |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-07-08 : 13:55:43
|
| Yes, via temp tables although you don't need the UNION.CREATE TABLE #Temp(...)INSERT INTO #TempEXEC Sp1 ...INSERT INTO #TempEXEC Sp2 ...SELECT *FROM #TempDROP TABLE #TempTara |
 |
|
|
vipinspg
Starting Member
12 Posts |
Posted - 2005-07-09 : 07:59:08
|
| You can go for table variable rather than temp tables.DECLARE @v_records TABLE(.......)INSERT INTO @v_recordsEXEC sp1.....INSERT INTO @v_recordsEXEC sp2........SELECT * from v_recordsVipins. |
 |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2005-07-09 : 12:26:07
|
| Apart from the fact that you'll get the following error:EXECUTE cannot be used as a source when inserting into a table variable.Mark |
 |
|
|
|
|
|