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 |
|
learntsql
524 Posts |
Posted - 2011-01-05 : 01:41:20
|
| Hi All,I have 2 sps both returns the same columnns in the output.How to join those 2 sps?TIA. |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-01-05 : 01:54:08
|
| create table #a(...)insert #a exec sp1insert #a exec sp2select * from #aOr create an sp that combines the two.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
learntsql
524 Posts |
Posted - 2011-01-05 : 01:59:54
|
| Thankx....can we do it with CTEs. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-01-05 : 02:08:54
|
| You mean can you call an SP from within a cte - not with an exec.Might be able to do it via another connection but you wouldn't want to do that.It wouldn't help anyway - in this case you wouldn't get anything from a cte that you wouldn't get from a derived table.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
RobertKaucher
Posting Yak Master
169 Posts |
Posted - 2011-01-07 : 14:57:39
|
| My understanding is that an SP actually returns what the ANSI standard refers to as a cursor - not a table. So you cannot perform a join on it. See page 41 and Chapter 5 in SQL Server 2008 T-SQL Fundamentals. You will have to do something like what nigelrivett suggests.===http://www.ElementalSQL.com/ |
 |
|
|
|
|
|