Home Forums Reporting Services Reporting Services Subscriptions from Reporting Services get unintelligable job names in SQL Server Agent RE: Subscriptions from Reporting Services get unintelligable job names in SQL Server Agent

  • Hi Paul,

    The following should work

    SELECT

    Schedule.ScheduleID AS SQLAgent_Job_Name,

    Subscriptions.Description AS sub_desc,

    Subscriptions.DeliveryExtension AS sub_delExt,

    [Catalog].Name AS ReportName,

    [Catalog].Path AS ReportPath,

    SUBSTRING(ExtensionSettings, LEN('TO') + CHARINDEX('TO', ExtensionSettings), CHARINDEX('', ExtensionSettings, CHARINDEX('TO', ExtensionSettings) + 1) - (LEN('TO') + CHARINDEX('TO', ExtensionSettings))) AS 'To Email recipient List'

    FROM

    ReportSchedule

    INNER JOINSchedule

    ON ReportSchedule.ScheduleID = Schedule.ScheduleID

    INNER JOINSubscriptions

    ON ReportSchedule.SubscriptionID = Subscriptions.SubscriptionID

    INNER JOIN[Catalog]

    ON ReportSchedule.ReportID = [Catalog].ItemID

    AND Subscriptions.Report_OID = [Catalog].ItemID

    WHERE

    Subscriptions.DeliveryExtension = 'Report Server Email'

    Note that this SQL has some assumptions:

    1. that the ExtensionSettings field (a text field) won't be longer than 8000 characters;

    2. that you're only interested in the 'To' email address, it doesn't look for 'CC' or 'BCC' but with some minor manipulation of the search you could add this.

    HTH,

    Steve.