Automate data import from the command line

The /dataimport command imports data from a table or a view into an existing or new table or view. To import data from the command line, you need to pre-configure a template file (.dit) that stores all import 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 /dataimport [/option_name1[:value | [parameter1:value parameter2:value ..]] /option_name2 ..]

Get command-line help

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

dbforgesql.com /dataimport /?

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 import using the settings specified in the template file (.dit), use the /templatefile switch.

/dataimport /templatefile:"<file_path>"
  • Enter all the required parameters directly in the Command Prompt.
dbforgesql.com /dataimport /templatefile:"D:\ImportTemplate.dit" /connection:"Data Source=demo-mssql\SQL2025;Encrypt=False;Integrated Security=False;User ID=sa;Password=password" /inputfile:"D:\Production.Product.csv" /table:"AdventureWorks2025.Production.Product" /errormode:abort
  • To execute the command, press Enter.

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

Examples

  • The command imports data using the settings specified in the data import template file (.dit).
/dataimport /templatefile:"D:\Import.dit"
  • The command imports data by overriding the connection and password specified in the data import template file (.dit).
/dataimport /templatefile:"D:\Import.dit" /connection:"Data Source=<server_name>;Initial Catalog=<database_name>;User ID=admin" /password:admin /table table_name
  • The command creates a new table for the imported data overriding the file containing the data to import and enables the Ignore all errors mode.
/dataimport /templatefile:"D:\Import.dit" /inputfile:"D:\Import.txt" /table:table_new /create /errormode:ignore
  • The command imports data into a new table.
/dataimport /templatefile:"D:\Import.dit" /inputtable:table1 /table:table_new /create