• Matt Toynbee (5/6/2009)


    Thanks a million - works great!

    Actually it only works great if you have single row delete. If you have a batch delete occur you will only get one email sent out and you cannot be guaranteed which row will be the one you alerted about.

    For example if I run this code:

    Delete

    From

    db_users

    Where

    UserName Like 'A%'

    You will get only 1 email.

    In my opinion, you really should stage the deleted data in a table and then have a job that reads that table and sends you an email or multiple emails. Or you could use SSRS and create an email subscription that sends you an email with deleted users in the last N minutes/hours.