Automate data export from the command line

The /dataexport command exports data from a file. To export data from the command line, you need to pre-configure a template file (.det) that stores all export settings.

Note

The template file doesn’t contain a password for security purposes. If you selected the Allow saving password option when creating a connection in dbForge Studio, no further action is required. If you didn’t save the password, you must specify it using the /password switch.

Warning

Parameter values specified directly in the command line override values in the template file.

Syntax

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

Get command-line help

To view command-line switches for /dataexport, run the following command:

dbforgesql.com /dataexport /?

Command details

  • To run dbForge Studio CLI commands, open Command Prompt and navigate to the folder that contains dbforgesql.com. The default path to this executable depends on where dbForge Studio for SQL Server is installed. If you installed dbForge Studio:

    • As a standalone tool
    "C:\Program Files\Devart\dbForge Studio for SQL Server"
    
    • As part of the dbForge Edge bundle
    "C:\Program Files\Devart\dbForge Edge\dbForge Studio for SQL Server"
    
  • To run data export using the settings specified in the template file (.det), use the /templatefile switch.

/dataexport /templatefile:"<file_path>"
  • Enter all the required parameters directly in the Command Prompt.
dbforgesql.com /dataexport /templatefile:"D:\ExportTemplate.det" /connection:"Data Source=demo-mssql\SQL2025;Encrypt=False;Integrated Security=False;User ID=sa" /table dbo.Employees dbo.Customers /range start:1 length:0 /errormode:abort
  • To execute the command, press Enter.

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

Examples

  • This command exports data using the settings specified in the data export template file (.det).
/dataexport /templatefile:"D:\Export_CSV.det"
  • This command exports data from several tables into a single file. The connection, tables, and password have been overridden and do not match the template.
/dataexport /templatefile:"D:\Export_CSV.det" /connection:"Data Source=<server_name>;Initial Catalog=<database_name>;User ID=admin" /password:admin /table table1 table2 /singlefile:true /outputfile:"D:\export_output.csv"
  • This command exports 10 records from the table and enables the Ignore all errors mode.
/dataexport /templatefile:"D:\Export_CSV.det" /range start:100 length:10 /outputfile:"D:\export_output.csv" /errormode:ignore
  • The command exports data overriding the destination table in the .sql file.
/dataexport /templatefile:"D:\Export_SQL.det" /outputtable:new_table /outputfile:"D:\export_output.sql"