Monday, July 3, 2017

Execute SSRS Report Subscriptions Manually

/*Execute SSRS Subscription Manually*/
/*Connect to Database ReportServer*/
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 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 '' --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*/
USE msdbEXEC sp_start_job @job_name '' Enter SQLAgent_Job_Name