Use below query to get Last Execution Date and TIme of the Report.
=================================================================
use ReportServer
go
Set transaction isolation level read uncommitted
select x.itemID,
x.name,
x.path,
x.lastRunDate,
x.avgTimeDataRetrieval,
x.avgTimeProcessing,
x.avgTimeRendering,
x.avgTimeDataRetrieval + x.avgTimeProcessing + x.avgTimeRendering as avgTimeTotal,
x.avgRowCount,
lastStat.status,
x.rsSuccessY,
x.rsSuccessN,
(x.rsSuccessY*1.0) / (x.totalEntries*1.0) as rsSuccessYpct,
x.lastNonSuccess,
x.totalEntries
from (
select c.itemID,
c.name,
c.path,
max(e.timeStart) as lastRunDate,
avg(e.timeDataRetrieval) as avgTimeDataRetrieval,
avg(e.timeProcessing) as avgTimeProcessing,
avg(e.timeRendering) as avgTimeRendering,
avg(e.[rowCount]) as avgRowCount,
sum(case when e.status = 'rsSuccess' then 1 else 0 end) as rsSuccessY,
sum(case when e.status = 'rsSuccess' then 0 else 1 end) as rsSuccessN,
(select max(timeStart) from executionLog where reportID = c.itemID and status != 'rsSuccess' and timeStart >= dateAdd(mm,-6,getDate())) as lastNonSuccess,
count(c.itemID) as totalEntries
from executionLog e
inner join catalog c on e.reportID = c.itemID
where e.timeStart >= dateAdd(mm,-6,getDate())
group by c.itemID,
c.name,
c.path
) x
left join (
select reportID,
max(timeStart) lastRunDate,
[status]
from executionLog
group by reportID, [status]
) lastStat on x.itemID = lastStat.reportID and x.lastRunDate = lastStat.lastRunDate
=================================================================
Ads
Subscribe to:
Post Comments (Atom)
-
Find More On : - http://www.sqlserver-training.com/250-sql-queries-interview-question-answers/-#5+ SQL Queries Interview Questions ...
-
ERROR: report server remote procedure call (RPC) end point. Verify that the Report Server Windows service is running, and then retry the o...
-
http://technet.microsoft.com/en-us/library/cc731002(WS.10).aspx#BKMK_requirements How accounts are created through wizards in ...
No comments:
Post a Comment