Triggers

  • I have been asked to set a trigger up to notify by email our clients when a new media code has been entered into the database.

    Having not created a trigger before I was wondering if anyone could help for I would like to know the best way of setting this up.

  • You have to create a trigger for insert on the table. Keep in mind that you have to configure the SQL Mail service to use the xp_sendmail command.

    This sample is from BOL:

    quote:


    The following trigger generates an e-mail whenever a new title is added in the pubs database:

    CREATE TRIGGER reminder

    ON titles

    FOR INSERT

    AS

    EXEC master..xp_sendmail 'MaryM',

    'New title, mention in the next report to distributors.'


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

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