Create custom pre- and post-execution scripts

After you have selected the options to manage synchronization script output and set synchronization options, you can create custom scripts that will be run before or after schema synchronization.

To set additional scripts:

1. To open the synchronization wizard, click Synchronization arrow Synchronize objects to the target database.

2. In the Schema Synchronization Wizard that opens, switch to the Additional Scripts tab to add pre- and/or post-execution scripts.

3. To insert the script to be executed before schema synchronization, select the Scripts to execute before checkbox and then select either of the following options:

  • Use embedded script: Enter a script you want to execute in the text field.
  • Use external script: Click More options icon More options to specify the path to the file that stores the script. If you want to add the USE database_name clause, select the Include USE < database_name > option.

For example, you need to create partition tables in the target database. However, there are no files and filegroups in that database. Schema Compare works only with database-level objects, all server-level objects will not be included in the comparison and, thus, in the synchronization script. In this case, you can run the script before schema synchronization.

Insert scripts to be used before schema synchronization

4. To insert the script to be executed after schema synchronization, select the Scripts to execute after checkbox and then select either of the following options:

  • Use embedded script: Type a script, which you want to execute, in the text field.
  • Use external script: Click More options icon More options to import the previously created script. If you want to add the USE database_name clause, select the Include USE < database_name > option.

5. Optional: Switch to the Summary page and verify the synchronization options.

6. After you’ve configured the synchronization options, click Synchronize.

Note

Schema Compare for SQL Server allows saving synchronization options as a .scomp file for further use, for example for automating and/or scheduling database synchronization tasks.

To save the synchronization settings (the .scomp file), you need to close the Schema Synchronization wizard after configuring all the necessary options (prior to clicking Synchronize). Then, in the comparison results document, click the Save icon or press Ctrl+S.

If you save the .scomp file before configuring the synchronization settings, it will contain the custom settings you configured in the Schema Comparison wizard and the default synchronization settings.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge Schema Compare for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the Schema Compare in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the Schema Compare for your business, request a demo to see it in action.
Ready to start using dbForge Schema Compare for SQL Server?