我有一个要求,无论何时修改特定表中的条目,都需要在SSRS 2014中自动生成报告。有什么办法可以做到这一点? 例如,下面提到的代码段是我的表格。每当day_status从打开“ O”更改为关闭“ C”时,都需要生成报告。Table in my DB
答案 0 :(得分:0)
您可以做的是为报表设置订阅,然后在表上设置触发器以在状态更改时运行此报表订阅。
运行此命令以查找订阅作业名称
SELECT
sj.[name] AS [Job Name],
rs.SubscriptionID,
c.[Name] AS [Report Name],
c.[Path],
su.Description,
su.EventType,
su.LastStatus,
su.LastRunTime,
c.Parameter,*
FROM msdb..sysjobs AS sj
INNER JOIN ReportServer..ReportSchedule AS rs
ON sj.[name] = CAST(rs.ScheduleID AS NVARCHAR(128))
INNER JOIN ReportServer..Subscriptions AS su
ON rs.SubscriptionID = su.SubscriptionID
INNER JOIN ReportServer..[Catalog] c
ON su.Report_OID = c.ItemID
where c.[Name] like '%your report%'
您可以使用上方的工作名称来触发订阅:
USE [msdb]
EXEC sp_start_job @job_name = 'the GUID of the Job from the above query'
您可以将其包装在存储过程中,并将其用作触发器的一部分