Failed Subscription Alerting T-SQL Script
USE ReportServer GO DECLARE @count INT SELECT Cat.[Name], Rep.[ScheduleId], Own.UserName, ISNULL(REPLACE(Sub.[Description],'send e-mail to ',''),' ') AS Recipients, Sub.[LastStatus], Cat.[Path], Sub.[LastRunTime] INTO #tFailedSubs FROM dbo.[Subscriptions] Sub with (NOLOCK) INNER JOIN dbo.[Catalog] Cat with (NOLOCK) on Sub.[Report_OID] = Cat.[ItemID] INNER JOIN dbo.[ReportSchedule] Rep with (NOLOCK) ON (cat.[ItemID] = Rep.[ReportID] and Sub.[SubscriptionID] =Rep.[SubscriptionID]) INNER JOIN dbo.[Users] Own with (NOLOCK) on Sub.[OwnerID] = Own.[UserID] WHERE Sub.[LastStatus] NOT LIKE '%was written%' --File Share subscription AND Sub.[LastStatus] NOT LIKE '%pending%' --Subscription in progress. No result yet AND Sub.[LastStatus] NOT LIKE '%mail sent%' --Mail sent successfully. AND Sub...