Requirement: Subscription failed for more than 10 days, then disable and Delete the Subscription
I found script something like this..
select c.Name as ReportName,
s.Description as SubscriptionDescription,
s.LastStatus as LastSubscriptionStatus,
when recurrencetype = 1 then 'One Time'
when recurrencetype = 2 then 'Hourly'
when recurrencetype = 4 then 'Daily'
when recurrencetype = 5 then 'Monthly'
when recurrencetype = 6 then 'Month Week'
end as RecurranceType,
u.UserName as SubscriptionSetUpBy,
s.ModifiedDate as SubscriptionLastModifiedDate
from [ReportServer].[dbo].[Subscriptions] s
join [ReportServer].[dbo].[Catalog] c
on c.ItemID = s.Report_OID
join [ReportServer].[dbo].[Users] u
on u.UserID = s.OwnerID
join [ReportServer].[dbo].[reportschedule] rs
on c.itemid = rs.reportid
and s.subscriptionid = rs.subscriptionid
join [ReportServer].[dbo].[schedule] sch
on rs.scheduleid = sch.scheduleid
where s.EventType <> 'RefreshCache'
and s.LastRunTime < dateadd(D, -10, getdate())
order by c.name
To Disable and Delete the Subscription what are the steps to be added..
Thanks in advance