Open menu
KS DB Merge Tools logo KS DB Merge Tools
database diff & merge
MssqlMerge logo for SQL Server
aka MssqlMerge
KS DB Merge Tools for MySQL logo
KS DB Merge Tools for PostgreSQL logo
KS DB Merge Tools for Oracle logo
KS DB Merge Tools for SQLite logo
AccdbMerge logo
KS DB Merge Tools for Cross-DBMS logo
KS DB Merge Tools All-In-One license
Other tools

Automation and Scripting

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:

  1. Write from scratch: Create a script manually in the Script Editor.
  2. Generate from GUI: Let the tool generate a script template based on current GUI state.

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.

Write Automation Script from Scratch

  1. 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.

    for SQL Server, Script Editor - setup
  2. 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.

    for SQL Server, Script Editor - validation result
  3. 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.

    for SQL Server, Script Editor - execution result
  4. 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".

  5. 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"

Generate Script from GUI

  1. 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.

    for SQL Server, Home tab, click Generate script
  2. 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.

    for SQL Server, Script Editor with a script for our current GUI tab