Additional /datareport arguments

Last modified: May 6, 2025

This topic gives a detailed description of command line switches and examples of their usage.

Arguments

To get more information on switches related to data reports in the command line interface, you can type:

 C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /?

Note

The path to the executable file will differ depending on how you have installed the Studio - as a standalone tool or as part of the dbForge Edge bundle. Make sure that you have specified the correct path. If you have installed the Studio as part of dbForge Edge, change the path accordingly:

C:\Program Files\Devart\dbForge Edge\dbForge Studio for SQL Server>dbforgesql.com

All switches available for this option are listed below, along with usage examples.

Argument Action and Usage
/connection This switch is used to specify a connection string with additional parameters. The command usage is as follows:/connection:<connection_string>Example of using the /connection argument:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /connection:"User Id=yourusername;Server=server_name"
/format This switch is used to specify report format. Note that the HTML report won’t be sent by FTP or email if the result contains several files or folders. The command usage is as follows:/format:<PDF|HTML|MHT|RTF|TEXT|CSV|EXCEL|EXCEL2007|BMP|EMF|GIF|JPEG|PNG|TIFF|WMF>Example of using the /format argument:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /format:"PDF"
/parameters The switch is used to specify values for parameters declared in a query script. The command usage is as follows:<param_name1>:<param_value1><param_name2>:<param_value2>Example of using the /parameters argument:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /parameters param1:value1 param2:value2
/password Use this switch if you want to specify a server password. This argument overrides the password specified in the connection string. The command usage is as follows:/password:"yourpassword"Example of using the /password argument:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /password:"yourpassword"
/reportfile Use this switch to specify the input report file. The command usage is as follows:/reportfile:<file name>The following example shows how to specify the input report file:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /reportfile:"sample_report.rdb"
/result Use this switch to specify what should be done with the result: save the report to disk or send it by email or FTP.You can specify SMTP settings on the corresponding Options dialog page. To open the Options dialog, navigate to the Tools menu and select Options. In the Options dialog that opens, select Environment > SMTP. The command usage is as follows:/result folder:<file path> | email:<email address> | ftplogin:<login> ftppassword:<yourpassword>Usage examples:1. Report is saved to the specified folder on disk in the CSV format:/datareport /reportfile:"D:\workDir\dept.rdb" /format:CSV /result folder:"D:/output/"2. Report is sent by email:/datareport /reportfile:"D:\workDir\dept.rdb" /format:CSV /result email:"address@hostname.net"3. Report is sent by FTP:/datareport /reportfile:"D:\workDir\dept.rdb" /format:CSV /result folder:"ftp://hostname.net/output/" ftplogin:user_name ftppassword:"yourpassword"4. Report is sent by email and FTP:/datareport /reportfile:"D:\workDir\dept.rdb" /format:PDF /result email:"address@hostname.net" /result folder:"ftp://hostname.net/output/" ftplogin:user_name ftppassword:"yourpassword"
/resultfilename The switch is used to specify a report name. The command usage is as follows:/resultfilename:<document name>Example of using the /resultfilename argument:C:\Program Files\Devart\dbForge Studio for SQL Server>dbforgesql.com /datareport /reportfile:"sample_report.rdb" /resultfilename:report1

Worked example: How to specify parameters from the command line

Let’s create a parameterized report that filters sales data based on the territory name - New England - using the territory_name report parameter, and then export the report via the command line.

The sample database is AdventureWorks2022.

To create a parameterized report, the following command-line syntax will be used:

 "C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"Report1.rdb" /parameters territory_name:"value" /format:HTML /result folder:"D:\Report\Output\"

where:

  • Report1.rdb is the path to the report you’ve created based on a custom query.
  • value is the parameter value by which the data in report will be filtered. You’ll need to specify it manually in the command line.
  • HTML is the report format.
  • D:\Report\Output\ is the path to the result report to be generated in the specified format upon the command execution.

The workflow is as follows:

  • Step 1: Create a report template
  • Step 2: Run the report from the command line

Prerequisites

The following query will be used as the data source for your report to create a parameterized query.

SELECT 
    st.Name AS TerritoryName,
    soh.SalesOrderID,
    soh.OrderDate,
    soh.TotalDue,
    p.FirstName,
    p.LastName
FROM 
    Sales.SalesOrderHeader AS soh
    INNER JOIN Sales.SalesTerritory AS st ON soh.TerritoryID = st.TerritoryID
    INNER JOIN Sales.Customer AS c ON soh.CustomerID = c.CustomerID
    INNER JOIN Person.Person AS p ON c.PersonID = p.BusinessEntityID
WHERE 
    st.Name = @territory_name
ORDER BY 
    soh.OrderDate DESC;

where @territory_name is the parameter name you’ll need to specify in the command line.

To view the available sales territories so we can later choose a desired one on which the data will be filtered, execute the following query:

SELECT DISTINCT Name FROM Sales.SalesTerritory ORDER BY Name;

The screenshot displays a list of the following territories:

View a list of available sales territories

Step 1: Create a report template

To create a report:

1. On the Database menu, select Report Designer.

2. In the Data Report Wizard that opens, select a Standard Report report type and select Next.

3. On the Choose a data connection page, select a database connection and a Custom Query data type and select Next.

4. On the Create a new query page, enter a query from prerequisites with a declared parameter and select Next.

Create a new query - Data Report Wizard

5. On the Choose columns to display in your report page, select the columns you want to display in the report and select Finish.

6. To save the report, go to the SQL toolbar and select Save.

6.1. In the Save As window that opens, enter a name for the report, choose the folder where it should be saved, and select Save. In our example, the full path to the report template is D:\Report\SalesTerritoryReport.rdb.

Step 2: Run the report from the command line

In our example, we want to get sales data for the New England sales territory.

To retrieve the data from the command line:

1. Open the Command Prompt.

2. In the Command Prompt, replace the parameters from the following command with your actual data and execute the command:

 "C:\Program Files\Devart\dbForge Studio for SQL Server\dbforgesql.com" /datareport /reportfile:"D:\Report\SalesTerritoryReport.rdb" /parameters territory_name:"New England" /format:HTML /result folder:"D:\Report\Output\"

where:

  • D:\Report\SalesTerritoryReport.rdb is the path to the created report.
  • New England is the parameter value by which the report data will be filtered.
  • HTML is the report format.
  • D:\Report\Output\ is the path to the result report to be generated in the specified format upon the command execution.

The report with a parameterized query is generated and saved to the D:\Report\Output\ folder.

Result - Report with a parameterized query