Как запустить SQL сценарий сразу на нескольких БД

Иногда требуется выполнить некий SQL скрипт сразу на множестве баз данных. 

1. Для этого используйте следующий подход: 

Включаем режим SQL CMD в SSMS: Options / query execution / sql server / common / Open SQL CMD Mode checkbox

2. Сохраняем пакет SQL в файл

3. Готовим такой скрипт:

USE db1;
:r C:\temp\1.sql
GO

USE db2;
:r C:\temp\1.sql
GO

USE db3;
:r C:\temp\1.sql
GO

Таким образом подготовив 1 раз шаблон подобного скрипта можно обновлять скрипты на множестве баз даных.

Подробнее: 

Additional

SQL-tool for creating personal accounts on the site

The essence of the approach and the history of the creation of Falcon Space
Web platform for creating personal accounts

Falcon Space Platform

This is a reduction in the cost of ownership

at the expense of fewer people to support

This is a quick change

while using the program

This is a modern interface

full adaptation for mobile devices

MS SQL web applications. Affiliate program for developers and web studios

You can develop yourself or collaborate with us for web development on the Falcon Space platform using only SQL and HTML.
View examples with SQL code
Platform documentation
Working on MS SQL Server
Component demo stand
At the stand you can see various components in action - tables, forms, modal windows, diagrams, a map, etc.
Solution demo site
Basic solutions that can be flexibly adapted for yourself - change the appearance, business logic and even the structure of the database.
Discuss the project
Ask the initial questions about the project that concern you right now. We will advise you for free and recommend the best solution.