DEV Community

Samantha Brauer
Samantha Brauer

Posted on

SQL Manager Tool: How to Specify Parameters in a Report Through the Command Line

dbForge Studio for SQL Server gives users an opportunity to automate a variety of database management processes. As a modern SQL manager tool, it also allows specifying parameters in a report through the command line.

The /parameters switch is used to specify values for parameters declared in a query script. To perform this task, you only need to type the name of a parameter and its corresponding value in the following format:

<param_name1>:<param_value1>
<param_name2>:<param_value2>

<param_namen>:<param_valuen>
Enter fullscreen mode Exit fullscreen mode

The command line will look like this:

_C:\Program Files\Devart\dbForge Studio for SQL _Server>dbforgesql.com /datareport /parameters param1:value1 param2:value2

In the regular workflow, you would normally need to:

  • Write a query script
  • Execute the query
  • Specify the required parameters in the Edit Parameters dialog box that appears during query execution
  • Create a report using the Data Report Wizard

Alternatively, parameters can also be specified in an already created Data Report.

Example

Let's look at a practical example where we need to filter employees by their ID number in the Employees database and find the employee with ID 963.

Below is a query script containing the @id parameter with the value 963.

To specify parameters through the command line, run the following command:

"C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"Report1.rdb" /parameters id:963 /format:HTML /resultfolder:"D:\report\"

In this command:
/parameters id:963 specifies the parameter value
/format:HTML exports the report in HTML format
/resultfolder defines the destination folder for the generated report

If the process is completed successfully, the output folder containing the result file will be displayed.

The report generated with parameters specified through the command line looks identical to the report created manually with the Data Report Wizard.

Thus, specifying parameters through the command line helps save time and allows you to generate reports automatically without manually entering parameter values each time. This makes dbForge Studio for SQL Server a convenient SQL manager tool for automating SQL Server reporting tasks.

To learn more about additional command-line arguments supported in dbForge Studio for SQL Server, refer to the official documentation.

You can also learn more about specifying parameters through the Data Report Wizard in the Report Parameters article.

Top comments (0)