Reputation: 911
I am working in SSMS. I have an object that I want to edit on several servers/databases simultaneously. I start with opening the object via Object explorer and editing/testing there. Once I am done, I go to Registered servers, and copy+paste the object code to update it on all the locations. Is there a faster way to do this? Right clicking and choosing Change connection only works with one Server at a time and does not allow to choose anything from the Database engine.
Upvotes: 3
Views: 380
Reputation: 5940
SSMS has a SQLCMD mode.
By enabling it changing of the current connection can be part of the script:
:connect (local)
SELECT name from sys.databases
-- run some other script
:connect anotherServer
SELECT name from sys.databases
-- run some other script
Another approach is Multi-database Query:
In such case, servers to be pre-grouped into folders based on your criteria
References:
Upvotes: 1