Data driven subscriptions, step 3

  • A screen shot of this step is attached. I am having trouble finding specific information about this step. The documentation that I've found reads like I should already know something I don't.

    But what I need to do here is not just provide a list of recipients, but provide a list of "TO" recipients, and a list of "CC" recipients. I'm not sure how to do this, or even the format it's expecting. Two different column headers? Or Two different result sets? I'm just not seeing what exactly needs to be done. 

    Can anyone help?

    Thank you,

    Amy

  • Well, I got it. 

    SELECT 'Audit Report' AS [Subject],
    (
    SELECT STUFF((
    SELECT ';' + Email
    FROM ReportSubscription a
    WHERE a.ReportGroup IN ('To')
            AND a.Active = 1
    FOR XML PATH('')) ,1,1,'')
    ) AS [TO],

    (
    SELECT STUFF((
    SELECT ';' + Email
    FROM ReportSubscription a
    WHERE a.ReportGroup = ('CC')
            AND a.Active = 1
    FOR XML PATH('')) ,1,1,'')
    ) AS [CC]

  • Amy.G - Tuesday, October 3, 2017 1:34 PM

    Well, I got it. 

    SELECT 'Audit Report' AS [Subject],
    (
    SELECT STUFF((
    SELECT ';' + Email
    FROM ReportSubscription a
    WHERE a.ReportGroup IN ('To')
            AND a.Active = 1
    FOR XML PATH('')) ,1,1,'')
    ) AS [TO],

    (
    SELECT STUFF((
    SELECT ';' + Email
    FROM ReportSubscription a
    WHERE a.ReportGroup = ('CC')
            AND a.Active = 1
    FOR XML PATH('')) ,1,1,'')
    ) AS [CC]

    Answers often come to mind right after posting a question. There should be a name for that phenomenon. 🙂

    But thanks for posting back how you addressed it - helps others who come across this thread with the same questions.

    Sue

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply