?? on an email Trigger to attach a SSRS report ??

  • Hi

    So I finally have the basic Idea on how to write a trigger.

    This trigger will execute after insert. (see below)

    What I would Like to do is add a SSRS report as an attachment

    which would display some of the information just added

    I'm assuming here, but I guess I would create a subscription, then somehow

    run and insert ?

    Would I be better to insert the data in the body ?

    Thanks

    Joe

    ALTER TRIGGER [dbo].[TESTEMAIL] on [dbo].[EMPLOYEE]

    AFTER INSERT

    AS

    SET NOCOUNT ON;

    DECLARE @body varchar(max)

    SELECT @body= 'A new empoyee with the first name ' + fname + ' was added to the Employee table ' FROM inserted;

    IF EXISTS (SELECT 1 FROM inserted

    WHERE FNAME = 'JOE')

    BEGIN

    EXEC msdb.dbo.sp_send_dbmail

    @recipients = 'name@email.ORG',

    -- @profile_name = 'dbmail',

    @subject = 'Name added...WARNING',

    @body = @body

    END

Viewing 0 posts

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