dbForge SQL Complete supports a command-line interface, which means you can automate code formatting in SQL Complete using the command line.
1. Run the Command Line in Windows 11:
From the Windows taskbar
Using shortcut keys
2. To access the dbForge SQL Complete functionality from the command line, navigate to the sqlcomplete.com file, located in the installation folder of the tool. The default installation folder is C:\Program Files (x86)\Devart\dbForge SQL Complete.
cd "C:\Program Files (x86)\Devart\dbForge SQL Complete"
3. To format the code, execute the /formatsql
command by replacing the arguments with your actual data. The command formats SQL files with the specified profile:
sqlcomplete.com /formatsql /sourcefile:"D:\NoFormat.sql" /outputfile:"D:\Format.sql"
where:
"D:\NoFormat.sql"
is a path to the source SQL file to be formatted."D:\Format.sql"
is a path to an output file where the formatting results of the source file will be saved.To get quick help on the arguments available in the command line, type the following:
sqlcomplete.com /?
To get detailed information about each command-line operation, execute the following command and specify the required option value sqlcomplete.com /option_name /?
. For example, sqlcomplete.com /formatsql /?
.
Additionally, you can watch this video to learn how to format SQL script files from the command line and how to automate the process using PowerShell.
Also, if you want to know how to involve dbForge SQL Complete in the Database DevOps process, watch this video.