The /execute command runs SQL scripts from the command line. You can execute a single file or all files in a .zip archive.
Note
The command-line interface is available only in certain editions of dbForge Studio for SQL Server. For more information, see the Editions page.
dbforgesql.com /execute [/option_name1[:value | [parameter1:value parameter2:value ..]] /option_name2 ..]
To view command-line switches for /execute, run the following command:
dbforgesql.com /execute /?
The output displays all switches and their descriptions.
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
You can execute a single SQL file or multiple SQL files packaged in a .zip archive. Files in the archive are executed in sequence.
The command processes the specified files according to the arguments provided in the command line or in an argument file (/argfile).
To keep credentials secure and simplify managing configurations for different environments, you can store all arguments in a text file and reference it with /argfile:<file_path>.
1. Create an argument file (for example, deploy-arguments.txt) that contains all required arguments.
/execute
/connection:"Data Source=DBMSSQL\SQLEXPRESS02;Integrated Security=False;User ID=app_user"
/inputfile:"C:\Scripts\deploy.sql"
/password:P@ssw0rd123
2. Execute the command that references the argument file.
"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /argfile:"C:\Config\deploy-arguments.txt"
The script runs by using the arguments stored in the file, and sensitive values such as the password do not appear directly in the command line or in the command history.
When you need to execute a single SQL script against a database, run the command with connection details and the script file path.
dbforgesql.com /execute /connection:"Data Source=DBMSSQL\SQLEXPRESS02;Integrated Security=False;User ID=app_user" /inputfile:"C:\Scripts\update-schema.sql" /password:P@ssw0rd123
This command connects to the DBMSSQL\SQLEXPRESS02 SQL Server instance and executes the update-schema.sql script. The /password argument supplies the password required for the connection.
When you have multiple related scripts packaged together, you can execute them directly from a .zip archive without extracting the files.
dbforgesql.com /execute /connection:"Data Source=DBMSSQL\SQLEXPRESS02;Integrated Security=False;User ID=app_user" /inputfile:"C:\Releases\release_1.2.zip" /password:P@ssw0rd123
This command executes all SQL scripts contained in the release_1.2.zip archive in sequence.
To execute a script against a specific database, specify the /database argument.
dbforgesql.com /execute /connection:"Data Source=DBMSSQL\SQLEXPRESS02;Integrated Security=False" /inputfile:"C:\Scripts\shared_script.sql" /database:AdventureWorks2022 /password:P@ssw0rd123
This command executes the script to run against the AdventureWorks2022 database. Fully qualified object names (for example, AdventureWorks2022.Sales.Customer) are not affected by this argument.