Friday, July 01, 2011

Find the Report Name and its Execution time from ReportServer database on SSRS

-- Find Report Name from catalog table
Use ReportServer
go

select Type, Name, Path ,ItemId,ParentID
from [Catalog] where name like 'MyReport%'and Type = 2

 -- Find the ExecutionLog history for the Report of ItemId
select * from ExecutionLog where ReportID = '1C380565-ZXF9-9618-3727-28A04652E1B9'


 -- Please note reference between [Catalog] and [ExecutionLog] table is ItemId=ReportID

select c.name , e.ReportID, e.InstanceName,e.Format,e.TimeStart,e.TimeEnd
from [Catalog] c, ExecutionLog e
where c.ItemId= e.ReportID
and c.name like 'MyReport%' and c.Type = 2
order by e.TimeStart desc


SELECT distinct
sj.[name] AS [Job Name],
rs.SubscriptionID,
c.[Name] AS [Report Name],
c.[Path]
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 '%daily data%'