简体   繁体   English

数据驱动订阅,仅当达到数据库值时

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

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. 我已经建立了我的报告以使用hading子句显示值,因此它将显示该值。

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. 我有SQL 2012,还有一个测试环境为2014。我有Reporting Services的本机安装和SharePoint安装。

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. 当您为SSRS作业创建订阅时,SQL Agent将创建一个看起来像这样的作业: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. 有关更多详细信息/示例,请参见此MSDN线程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM