Monday, 12 November 2018

Disabling SSRS Reports Subscription



Step I:


The below query can retrieve the ScheduleID


Use ReportServerDatabase
go
select cl.ItemID,cl.Path,cl.Name,rs.ScheduleID from Catalog cl inner join ReportSchedule rs on cl.ItemID = rs.ReportID


where cl.path like '/LearnerReports/%'  -- This is the path where you have the SSRS.


Step II:


Once Recevied the scheduleID, concatenate with excel or loop to get all the SQL Server Agent jobs for SSRS to be disabled.


Use msdb
go
exec sp_update_job @job_name = 'jobname',@enabled = 0 -- by default, the jobname is equal to the scheduleID.


Example after Loop or Concatenate:




exec sp_update_job @job_name = '9B7E93A0-F5A-4GBF3-8B8E-253EC2E27819',@enabled =0
exec sp_update_job @job_name = '8B7E97A0-F8A-4GBG3-8B8E-259EC2E27200',@enabled =0