Hi FJInfante!
Although, I do not get your actual requirement. But,
In this case, I would suggest you to create two stored procedures -
[proc1] Created at server1
[proc2] Created on other servers that call proc1 located at server1.
Proc1
------------------------------------------------------
create proc proc1
@server varchar(128) , @database varchar(128),
@table varchar(128)
as
declare @stm nvarchar(2000)
set @stm = 'select * from '+ @server + '.' + @database + '.dbo.' + @table
Execute sp_executesql @stm
go
-------------------------------------------------------
proc2
-------------------------------------------------------
create proc proc2
as
declare @dbname varchar(128)
set @dbname = db_name()
execute server1.master.dbo.proc1 @@servername , @dbname , 'table1'
-------------------------------------------------------
So, all the servers have to create proc2 that will just call proc1 located at server1.
@@servername would produce the server name that calls and db_name() would produce the current database.
Explain server and database related details if you do not understand this example or may be, I do not understand your problem.
Reply soon..
|