Invoke SSRS Subscription from Database

Take the first block of code and search by your report name. Take the SQLAgent Job Name and apply it to the msdb.dbo.sp_start_job to fire off your SSRS Subscription.

USE ReportServer
GO

/Execute SSRS Subscription Manually/
/Connect to Database ReportServer/
SELECT
sub.LastStatus
,s.ScheduleID AS SQLAgent_Job_Name
,SUB.Description AS Sub_Desc
,SUB.DeliveryExtension AS Sub_Del_Extension
,C.Name AS ReportName
,C.Path AS ReportPath
FROM ReportServer.dbo.ReportSchedule RS
INNER JOIN Schedule S ON (RS.ScheduleID = S.ScheduleID)
INNER JOIN Subscriptions SUB ON (RS.SubscriptionID = SUB.SubscriptionID)
INNER JOIN [Catalog] C ON (RS.ReportID = C.ItemID AND SUB.Report_OID = C.ItemID)
WHERE C.Name LIKE ‘%AFTEROWL%’ — Enter Report Name to find Job_Name

/Connect to Database MSDB on the Reporting Server/
/Enter SQLAgent_Job_Name to execute the subscription based on Job ID/

EXEC msdb.dbo.sp_start_job @job_name = ‘7229B588-626C-43B9-8B18-028582673464’

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s