Once you've installed SQL Multi Script, you will have a simple way of executing multiple scripts against multiple SQL Servers. This walkthrough will show you how to complete the task in the first few minutes of using SQL Multi Script. Including:
- How to open and create scripts with SQL Multi Script
- How to set up a database distribution list to execute scripts against
- How to execute multiple scripts against multiple databases with a single click
- How to view and save the results
On opening SQL Multi Script, it's easy to create new scripts or add existing saved scripts for deployment to our databases. To begin with, a new, blank script, script1.sql is created for us. Right-clicking on our new script on the Scripts to Execute pane enables us to save it. To open an existing script we can click Add and browse to find the saved script. On this occasion, we will open an existing script called CreateSchema.sql; this script will create a schema on three databases for us.
We then repeat the same steps to add a further two scripts: InsertData.sql and SelectData.sql.
We have now opened and created all the scripts in the Scripts to Execute pane that we need for our tasks.
We now need to set up a database distribution list against which we can execute our scripts. In the Database Distribution List pane, we must click Configure. We can then view the databases on our SQL Server by expanding the list in the Databases to Add pane. Clicking the Add button enables us to move the three databases we need to our new database distribution list.
Before we execute the scripts, we can determine how we want SQL Multi Script to behave if there is an error on execution. This time, we will choose Stop executing. This means SQL Multi Script will stop executing against all scripts on all databases if there is an error. We can now execute the scripts. The first script will create the database schema, followed by the second script to populate the databases with our data, and finally a third script to query the database and retrieve data.
To execute our scripts against our three databases in one go, we click Execute Now.
The results appear in the Results pane that allows us to browse between the messages and results for different scripts and databases. Highlighting a separate script in the Scripts Executed pane means we can see the results for just that script. We click on the SelectData.sql script to view the results. In this script, we asked to retrieve data from the data with which we just populated our three databases.
We can choose to view the results either as a grid or as text. Depending on our decision here, we can save the results as a .csv or .txt file that can then be opened in an external application.
These fast and easy steps, from creating a script through to saving the results returned, cut out time-consuming and repetitive administration during script deployment.
The online help file (press F1 when SQL Multi Script is open) also provides further advice and tips for executing scripts against, and running queries across, your SQL databases and servers. We can also click on the question mark buttons for on-the-spot assistance at specific places throughout the user interface.
And that's it! If you would like to see how SQL Multi Script can help you, try it now with a free, fully functional and supported 14-day evaluation.
Try a 14-day fully functional free trial of SQL Multi Script.
With our full set of SQL development tools you can code fast, collaborate easily, and deploy accurately. Sound good?