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
 General SQL Server Forums
 New to SQL Server Programming
 help me this one please

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-09-27 : 00:24:46
i have 3 procedures in 3 servers the data storing into 3 different table i want create procedure that runs three procedures and insert out put into a one table please

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-09-27 : 01:10:40
you could do something like this, with linked server calls:

insert LocalTable exec REMOTE1.SomeDatabase1.dbo.SomeProc1
insert LocalTable exec REMOTE2.SomeDatabase2.dbo.SomeProc2
insert LocalTable exec REMOTE3.SomeDatabase3.dbo.SomeProc3


elsasoft.org
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-27 : 01:45:12
or use openrowset method

select t1.field,t2.fields,t3.fields
from(select * from OPENROWSET(...,'EXEC SomeDatabase1.dbo.SomeProc1'))t1
INNER JOIN (select * from OPENROWSET(...,'EXEC SomeDatabase1.dbo.SomeProc2'))t2
INNER JOIN (select * from OPENROWSET(...,'EXEC SomeDatabase1.dbo.SomeProc3'))t3


refer this link for syntax of OPENROWSET

http://msdn.microsoft.com/en-us/library/ms190312.aspx

also refer this link for selection of subset of columns from procedure resultset

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Go to Top of Page
   

- Advertisement -