How to consolidate multiple SQL scripts into a single SQL script

Having multiple SQL scripts and running them against a SQL database can be demanding. ApexSQL Build is a tool that can build databases from SQL scripts. The ApexSQL Build’s Consolidate scripts feature can combine multiple SQL scripts into a single SQL script in a very simple way, and more importantly, it can significantly decrease deployment time.

Combining multiple SQL scripts into a single script can be done in a few steps:

  1. Run ApexSQL Build

  2. Click the Consolidate button from the Home tab:

  3. Choose SQL as an output type:

  4. Add script files that should be combined. The order of the scripts execution can additionally be changed, as sometimes the order of scripts can determine and change the whole deployment process, or even prevent the deployment from being executed. For changing the order of scripts, there are the Up/Down buttons available:

  5. After selecting the necessary scripts, ApexSQL Build shows the Output options step which offers users to create and Save a copy of the script or to Open script in editor in the Script tab:

  6. Additionally, there’s a possibility to add the version number of the script, located under the Optional information tab, to keep track of script packaging and changes in case of repeating the session with additional updates, along with the Header options:

After choosing the appropriate output action, the combining process is complete, and all the necessary SQL scripts are combined into a single script.

The main advantage of using this feature is its simplicity and time saving when it comes to combining multiple SQL scripts into a single one for easier deployment.


March 12, 2015