Report Data Sets (SSRS)
A data set defines the data that a report uses. In SQL Server Reporting Services (SSRS), a data set consists of a query that retrieves data from a data source and the resulting fields that can be used in report items.
Creating a Data Set
- Open the Report Designer.
- Right‑click the Datasets node in the Report Data pane and select Add Dataset….
- Enter a name, choose a data source, and define the query.
- Click Refresh Fields to retrieve column metadata.
SELECT EmployeeID, FirstName, LastName, Title
FROM HumanResources.Employee
WHERE Title = @Title
Fields and Parameters
After creating a data set, the fields become available for drag‑and‑drop onto report items. Parameters can be added to the query to filter data at runtime.
| Field | Data Type | Description |
|---|---|---|
| EmployeeID | Int | Unique identifier for the employee. |
| FirstName | String | Employee's first name. |
| LastName | String | Employee's last name. |
| Title | String | Job title. |
Applying Filters
Filters can be defined at the data set level to limit the rows returned without altering the underlying query.
{
"FilterExpression": "=Fields!Title.Value",
"Operator": "Equals",
"Value": "Sales Manager"
}
Examples
Below is a complete example of a shared data set used across multiple reports.
-- SharedDataSet.rdl
AdventureWorksDW
SELECT EmployeeID, FirstName, LastName, Title
FROM HumanResources.Employee
EmployeeID System.Int32
FirstName System.String
LastName System.String
Title System.String