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 |
|
imughal
Posting Yak Master
192 Posts |
Posted - 2004-07-16 : 03:13:58
|
| hi,i have 2 separate stored procedure with same resultant fields. i wnat to merge both procedure result.Store procedure 1 fieldsclinetid, process date, un process date, noof monthsStore procedure 2 fieldsclinetid, process date, un process date, noof monthsbut the result set is different. i need to show only record which are in stored procedure 2 and remove rec which already are in store procedure 1 and 2.how i can merge data on condition, any help will be appreciated.regards,IM |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-07-16 : 11:12:01
|
| Create 2 temporary tablescreate table #t1( ... )create table #t2( ... )insert #t1 exec proc1insert #t2 exec proc2select * from #t1 union select * from #t2or maybe like this ( no temp tables... )SELECT * FROM OPENROWSET('SQLOLEDB','ServerName';'UserName';'Password','exec pubs.dbo.p1') AS aUNIONSELECT * FROM OPENROWSET('SQLOLEDB','ServerName';'UserName';'Password','exec pubs.dbo.p1') AS bSELECT * FROM OPENROWSET('SQLOLEDB','server=sirius;Trusted_Connection=yes','exec pubs.dbo.p1')UNIONSELECT * FROM OPENROWSET('SQLOLEDB','server=sirius;Trusted_Connection=yes','exec pubs.dbo.p2')/rockmoose |
 |
|
|
|
|
|
|
|