My question has to do in regards to the ability of being able to create stored procedures that connect to multiple servers. If anyone's not familiar with it, there's a :CONNECT syntax in SQL that will switch where your query's being run from. For example:
:CONNECT SERVERNAME
SELECT *
FROM Table
GO
This would run the query from where the table is stored as opposed to using linked servers (which cause serious performance issues). Does anyone know if it's possible (and how to achieve it) to create stored procedures that switch between servers? I keep getting various error messages when trying to achieve it. Here would be an example:
:CONNECT SERVERNAME
SELECT *
FROM Table
GO
:CONNECT SERVERNAME2
SELECT *
FROM Table
GO
This would connect to two different servers in the same query.
Thanks
UPDATE - 4.26.2018
All,
We've pretty much decided OPENQUERY is our best solution, at least for stored procedures. Unfortunately, we'll be limited by syntax but performance is MUCH better than using linked servers (which is what we're currently using). I appreciate everyone that's chimed in; Your input was invaluable. If you wish to add anything else, please feel free to do so.
Thanks