Command-line interface

dbForge Studio for SQL Server supports a command-line interface (CLI) that enables you to automate and schedule data comparison and synchronization tasks. You can use the CLI for automated workflows or run comparisons without using the graphical interface.

What you can do with the command-line interface

  • Compare database data from the command line.
  • Synchronize data automatically.
  • Run data comparisons in batch mode.
  • Integrate data operations into CI/CD pipelines.
  • Schedule recurring synchronization tasks.

Availability

The command-line interface is available in the Professional and Enterprise editions of dbForge Studio for SQL Server.

Access to the command-line functionality

To use the dbForge Studio command-line interface, open the dbForge Studio for SQL Server installation folder that contains the dbforgesql.com file.

dbforgesql.com is a command-line interface (CLI) executable installed with dbForge Studio for SQL Server. You can use it for running SQL scripts from the command line and automating database tasks.

Command-line syntax

The /datacompare command launches data comparison and synchronization.

dbforgesql /datacompare [/option_name1[:value | [parameter1:value parameter2:value ..]] /option_name2 ..]

Example

/datacompare /source connection:"Data Source=demo-mssql\SQLEXPRESS02;Encrypt=False;Initial Catalog=AdventureWorks2022Dev;Integrated Security=False;User ID=JordanS" /target connection:"Data Source=demo-mssql\SQLEXPRESS01;Encrypt=False;Initial Catalog=AdventureWorks2022Test;Integrated Security=False;User ID=JordanS" /MappingIgnoreCase:Yes /MappingIgnoreUnderscores:Yes /sync:"C:\Users\JordanS\Desktop\AdventureWorks2022 (development) vs. AdventureWorks2022 (production).sql"

For detailed automation scenarios, see:

  • Automate data comparison and synchronization.
  • Automate script execution.
  • Schedule database synchronization.

Command-line switches

The following command enables you to view the switches available for /datacompare.

dbforgesql /datacompare /?

For the complete list of switches, see Command-line switches.

Command-line options

You can specify comparison and synchronization options in the following ways:

  • Directly in the command prompt

    Use full or short option names with the /options switch.

    For the complete list of command-line options, see Command-line options.

  • Using an arguments file

    Generate a .txt arguments file with the help of the New Data Comparison wizard, then specify it using the /argfile switch:

    dbforgesql /datacompare /argfile:"D:\FileWithArguments.txt"
    

Command-line exit codes

The /datacompare command returns exit codes that indicate the operation result. For the complete list of exit codes, see Command-line exit codes.

Command-line wizard

dbForge Studio provides a built-in command-line wizard that helps you generate reusable command-line commands based on actions configured in the graphical interface.

Instead of writing command syntax manually, you configure a data comparison or synchronization. The wizard then generates the corresponding command-line syntax, which you can review, edit, and save as a .bat file for reuse or scheduling.

Command-line wizard for data comparison and synchronization