MssqlMerge can perform many database comparison and synchronization tasks without user interaction. It includes a built-in scripting language designed to automate common workflows.
For example, you need a nightly CI build that checks for schema changes between your Dev and Staging databases. While this report can be generated manually using the GUI (see Schema Changes Summary use case), automation is required for unattended execution.
This section covers two ways to create automation scripts using the Script Editor:
Licensing note: On Windows this feature is available only in the Standard version. The Linux CLI tool may be used freely for personal and manual business use. A Standard license is required for automated usage in companies and organizations, as well as for all use under WSL on Windows.
Open the Script Editor application. The suggested script example includes BatchObjectsDiff
, which is used to get a schema changes summary. All available functions and parameters are described in the documentation. Update A connection strings, B script log path, and C JSON report file paths. Click D Check script for errors (without run) to validate.
Check E validation result. EXIT CODE: 0 with no errors means success. If errors occur, fix the script and revalidate. After successful validation, click F Run script.
Check G execution result. EXIT CODE: 0 indicates success. After execution, the Script Editor checks if log and result files were created and converts file paths into clickable links. In case of errors, H open the log file to review them. To verify results, I click the result file name to open it.
Once your script is ready, select and copy its text, paste it into a text editor, and save it with a *.ksdms
extension, for example as "c:\projectName\schemaDiff.ksdms".
Assuming MssqlMerge is installed on your CI server, create a pipeline task to run:
"c:\Program Files (x86)\MssqlMerge\MssqlMergeCmd.exe" "c:\projectName\schemaDiff.ksdms"
Open databases (see the Schema Changes Summary use case) and click A Show only new and changed to filter object types with differences. Then click B Generate automation script stub for this data.
The application opens Script Editor with a pre-filled function call (BatchObjectsDiff
) and parameters matching the current view. You only need to C replace TODOs file paths (and connection string passwords, if any). Then proceed with script validation and execution, as shown in the previous use case.