Filtering data for the current user
SSRS Reports has the ability to use the identity of the current user as a built-in variable within the report. This means the user ID can be used as a filter for SQL queries against a data source, assuming the data source stores that same ID.
In order for this recipe to work correctly, we will need to add IDs to the database. We will modify the
Dimension.Employee table within the
WideWorldImportersDW database to hold a fictitious manager ID field. First, open SSMS and execute the following query against the
ALTER TABLE [Dimension].[Employee] ADD [ManagerID] NVARCHAR(50)
Next, we will need to insert data into this column. In this example, you should replace the IDs shown ...