use ReportServer go DECLARE @ScheduledReportName varchar(200) DECLARE @JobID uniqueidentifier DECLARE @LastRunTime datetime Declare @JobStatus Varchar(100) -------------------------------------------------------- DECLARE @RunAllReport CURSOR SET @RunAllReport = CURSOR FAST_FORWARD FOR SELECT CAT.[Name] AS RptName , res.ScheduleID AS JobID , sub.LastRuntime , CASE WHEN job.[enabled] = 1 THEN 'Enabled' ELSE 'Disabled' END AS JobStatus FROM dbo.Catalog AS cat INNER JOIN dbo.Subscriptions AS sub ON CAT.ItemID = sub.Report_OID INNER JOIN dbo.ReportSchedule AS res ON CAT.ItemID = res.ReportID AND sub.SubscriptionID = res.SubscriptionID INNER JOIN msdb.dbo.sysjobs AS job ON CAST(res.ScheduleID AS VARCHAR(36)) = job.[name] INNER JOIN msdb.dbo.sysjobschedules AS sch ON job.job_id = sch.job_id INNER JOIN dbo.Users U ON U.UserID = sub.OwnerID WHERE sub.LastRunTime > GETDATE() - 1 and Cat.Name LIKE 'reportname%' >convert(date,GETDATE()-2) ORDER BY U.UserName, RptName OPEN @RunAllReport FETCH NEXT FROM @RunAllReport INTO @ScheduledReportName,@JobID,@LastRunTime,@JobStatus WHILE @@FETCH_STATUS = 0 BEGIN Print @ScheduledReportName --&' ' & @JobID EXEC msdb.dbo.sp_start_job @job_name =@JobID FETCH NEXT FROM @RunAllReport INTO @ScheduledReportName,@JobID,@LastRunTime,@JobStatus END CLOSE @RunAllReport DEALLOCATE @RunAllReport
Friday, September 01, 2017
Rerun failed SSRS subscriptions
Below is the script I have used to rerun the SSRS Report subscriptions that have failed today.
Subscribe to:
Post Comments (Atom)
Free Power BI Classes for Week 7 (Last)
Just completed the last class of the F ree P ower BI classes of this series. Today we have covered Adding a canvas background Adding Imag...
-
From the past 3 days I have been working on resolving merged and hidden cells issues when an SSRS reports is exported to excel. ...
-
When I tried to access the report manager after a fresh installation of Sql Server Reporting Serivces 2016 using the url http://localhost/R...
-
I was trying to build an SSIS package that one of my colleagues has created. The first error that was thrown was as below: Exception des...
No comments:
Post a Comment