Data Driven Subscription, only when a database value has been reached

87 views Asked by At

I want a report to be sent to a recipient when a daily total is reached. The total is a static value, but the time the total is reached will vary each day.

I have built my Report to show a value using a having clause, so it will show the value.

Now I need to configure the data driven to deliver the report when the having value is exceeded.

How do I do this?

I have SQL 2012 and also a test environment that is 2014. I have both native and SharePoint installations of reporting services configure.

1

There are 1 answers

0
Dave.Gugg On BEST ANSWER

Data driven subscription isn't really needed for this. When you create a subscription for a SSRS job, SQL Agent creates a job that will look something like this: 2197C9FE-0B3F-4BC6-AFF6-64EA7C977F33. If you want to run that subscription at a certain point in time, such as when a total is reached, you just need to fire off that job at that time. For example:

IF @DailyTotal >= 50,000 --Total to exceed
        BEGIN
            EXEC sp_start_job '2197C9FE-0B3F-4BC6-AFF6-64EA7C977F33'
        END

See this MSDN thread for more details/examples.