Schema Compare incorporates a built-in Command Line Wizard that allows converting the project’s comparison and synchronization options into command-line syntax and save it as a *.bat file.
It is a very convenient feature when it comes to scheduling or automating database comparison and synchronization. You can then use a *.bat file with a script and Windows Task Scheduler or any other task scheduler tool available to schedule the database comparison or synchronization.
You can select command-line file settings to manage *.bat file text in the Command line execution file settings dialog. You can open the dialog by selecting Save Command Line in:
1. New Schema Comparison Wizard
2. Schema Synchronization Wizard
The command line wizard has the following options:
Command-line file settings
Name | Default State | Description |
---|---|---|
Comparison Project | No | Load command-line settings from the previously created comparison project file with the .scomp extension. |
Source | Yes | Specify the source configurations: a server, a database, a connection, a snapshot, a backup, and a scripts folder. |
Target | Yes | Specify the target configurations: a server, a database, a connection, a snapshot, a backup, and a scripts folder. |
Comparison Options | No | Configure options to manage the comparison process. |
Report | No | Generate a schema comparison report file. |
Report Format | No | Specify the format of the file comparison report: HTML (default), XML, or XMLFOREXCEL. If not specified, the report file’s extension determines the file format. |
Include Objects | No | Specify the objects to be included in the report: All (default) - all objects Filtered - filtered objects Diff - objects with differences SelectForSync - objects selected for synchronization. |
Objects Filter | No | Apply a custom filter to include or exclude objects from comparison. |
Log File | No | Generate a comparison log file in the specified directory. |
Synchronization | Yes | Start database synchronization. If an output file is specified, only a synchronization script will be generated. |
Synchronization Options | No | Set options to manage the synchronization script. |
Synchronization File | Yes | Specify a path to the database synchronization script file. |
Execute | No | Execute the file obtained as the result of the previous commands execution. |
Error Code | No | Enable the processing of error levels. |
Arguments File | No | Specify the path to the command-line arguments file. If you select the path to an existing file, it will be used. If you provide a file name instead, a new file with the specified options will be generated. |
Echo OFF | No | Disable echoing all commands in the batch file. All the text in the batch file is enclosed in the @Echo OFF … @Echo ON command. |
Keep opened | No | Add the pause command at the end of the batch file text to keep the command window open after execution. |
PowerShell | No | Add the & symbol at the beginning of the batch file text to ensure compatibility with PowerShell. |
After setting the required options for the potential script, you can click Validate to check the accuracy of the code.
If the syntax is valid, you will receive the following message:
Otherwise, the correspondent warning will be displayed:
After validating the code, you can save the script as a *.bat file by clicking the Save button and specifying a path to its location.