I created this stored procedure to be able to run SSRS subscriptions using T-SQL code instead of adding a component in the SSIS package with the subscription id.
I created this stored procedure to be able to run SSRS subscriptions using T-SQL code instead of adding a component in the SSIS package with the subscription id.
CREATE PROCEDURE [dbo].[SR_RunSubscriptions] @Pattern varchar(max) AS BEGIN SET NOCOUNT ON; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; DECLARE @SubscriptionID nvarchar(max); DECLARE DbcurSQL CURSOR FOR ( SELECT SubscriptionID FROM [ReportServer].dbo.[Subscriptions] WHERE [Description] LIKE @Pattern ); OPEN DbcurSQL; FETCH NEXT FROM DbcurSQL INTO @SubscriptionID; WHILE @@FETCH_STATUS = 0 BEGIN EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription',@EventData=@SubscriptionID; FETCH NEXT FROM DbcurSQL INTO @SubscriptionID; END; CLOSE DbcurSQL; DEALLOCATE DbcurSQL; END