T-sql – Data driven subscription query parameters in SSRS

ssrst-sql

I am looking at customizing my data driven subscription query in SSRS so that depending on the results of the original query it will notify the correct department.

For example the query returns:

ID Dept   Amount Name 

1  Sales  $70    Shelly

Then the email only goes to the sales department and no other department such as marketing or HR

I am looking at using a data driven query and notifying users by email

Best Answer

When creating the dataset for the data-driven subscription, you can use those results to populate several email delivery options. For each row returned by the data-driven subscription dataset, it will send one email. Each of those rows should contain the necessary columns to feed the required parameters for each report to be unique to its recipients (i.e. Department), along with the email address(es) to which you want to send each report. The data-driven subscription will only send out reports for the rows its dataset returns, so you will need to make sure the data-driven subscription dataset returns rows that filter the report parameters correctly. If your report dataset will return more than one row, you will need to ensure data-driven subscription dataset results are grouped appropriately to ensure you send the reports in the desired granularity.

ID   Dept   Amount   Name     Email

1    Sales  $70      Shelly   shelly@email.com; sales@email.com

Data-Driven Subscription Dataset configuration

Data-Driven Subscription Email Delivery Options configuration