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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-10-21 : 08:01:42
|
Augustus Sundar writes "I have a stored procedure, Which returns a resultset in the first partthen it execute another stored procedure which returns another resultseti want to combine both resultsets into one.both resultsets having same set of columns,my code is below:-----------------create proc testprocasselect EmployeeId, EmpName from employeesunion all Exec testproc2create proc testproc2asselect EmployeeId, EmpName from employees2But it gives an error in the proc testprocThe reason why i am keeping the testproc2 seperately that it is being used for some other purpose too.Can anyone help me out?" |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-21 : 08:06:03
|
You need to create a temp table #t with same number of columns that sp returns and assign values thereCreate #t table(cols...........)Insert into #t Exec testprocGoInsert into #t Exec testproc2Now #t will have records from those two spsMadhivananFailing to plan is Planning to fail |
|
|
|
|
|