我们有许多具有多个订阅的报告,我希望能够通过查询Subscriptions表和ExecutionLog3 View来监视执行情况。
表和视图之间似乎没有明显的关系。
一个特定的报告具有一个数据驱动的订阅。每次使用不同的参数值执行报告多次。我特别想监视此订阅的进度。 我希望能够确定何时失败,何时以及使用了哪个参数。
我遇到了可能的解决方案here,但他接受的答案是错误的-查看评论
答案 0 :(得分:1)
See if this works for you... I've been using this for quite some time.
SELECT USR.UserName COLLATE Latin1_General_100_CI_AS_KS_WS AS SubscriptionOwner
,SUB.ModifiedDate as ModifiedDate
,SUB.[Description] COLLATE Latin1_General_100_CI_AS_KS_WS As Description
,SUB.EventType COLLATE Latin1_General_100_CI_AS_KS_WS as EventType
,SUB.DeliveryExtension COLLATE Latin1_General_100_CI_AS_KS_WS As DeliveryExtension
,SUB.LastStatus COLLATE Latin1_General_100_CI_AS_KS_WS as LastStatus
,SUB.LastRunTime As LastRunTime
,SCH.NextRunTime As NextRunTime
,SCH.Name COLLATE Latin1_General_100_CI_AS_KS_WS AS ScheduleName
,CAT.[Path] COLLATE Latin1_General_100_CI_AS_KS_WS AS ReportPath
,CAT.[Description] COLLATE Latin1_General_100_CI_AS_KS_WS AS ReportDescription
,CAT.Name COLLATE Latin1_General_100_CI_AS_KS_WS AS ReportName
FROM ReportServer.dbo.Subscriptions AS SUB
INNER JOIN ReportServer.dbo.Users AS USR
ON SUB.OwnerID = USR.UserID
INNER JOIN ReportServer.dbo.[Catalog] AS CAT
ON SUB.Report_OID = CAT.ItemID
INNER JOIN ReportServer.dbo.ReportSchedule AS RS
ON SUB.Report_OID = RS.ReportID
AND SUB.SubscriptionID = RS.SubscriptionID
INNER JOIN ReportServer.dbo.Schedule AS SCH
ON RS.ScheduleID = SCH.ScheduleID
INNER JOIN ReportServer.dbo.ExecutionLog3 EX
ON Cat.Path = EX.ItemPath AND EX.RequestType = 'Subscription'
ORDER BY 1,10