Dynamically Specify Linked Server and DB Names in Stored Procedure

Posted by hgulyan on Stack Overflow See other posts from Stack Overflow or by hgulyan
Published on 2010-06-09T06:21:40Z Indexed on 2010/06/09 7:22 UTC
Read the original article Hit count: 208

Filed under:
|

I have the same query in a stored procedure that needs to be executed on different servers and databases according to parameters.

How can I arrange this without exec or sp_executesql?

I'm using SQL Server 2008.

Thank you.

UPDATE

I've found some links

http://www.eggheadcafe.com/software/aspnet/29397800/dynamically-specify-serve.aspx

http://www.sommarskog.se/dynamic_sql.html

Is using SYNONYM possible solution? If yes, than how?

UPDATE 2

I forgot to mention that all this servers are linked to the server where stored procedure is stored.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about dynamic-sql