Reputation: 6050
How to execute same SP in 2 different connection.
Ex: ALTER PROCEDURE test ... ....
I want to execute this SP in db called "database1" in 192.168.1.100 and same in 192.168.1.102.
I want this to be done using script not using the change connection window
Upvotes: 1
Views: 184
Reputation: 41879
You can use SQLCMD to run a .sql file against multiple server connections.
sqlcmd -S <ComputerName>\<InstanceName> -i <MyScript.sql> -d <database_name> -T
Upvotes: 1
Reputation: 5002
You can do that in SSMS Tools Pack using one of its features called "Run one script on multiple databases".
Editing this to add that this is a tiny and free add-in to SQL Server, that you would find extremely useful.
Upvotes: 1