January 12, 2007 at 6:05 am
I am really new to working with SQL so bare with me.....I recently created a trigger on our SQL server that monitors the use of DDL against our production database. Whenever anything is done the information populates a table with the DDL command that was run, the time it was run and the user and computer it ran from. This is working just great but I want to set it up so that an email is sent out to an operator with this information as well. I have no idea how to do this. I know how to setup notifications in a job just by using the 'notifications' tab but scripting it is a whole new thing to me.
Anyone able to explain this in a way that even a noob would understand?
Thanks
January 12, 2007 at 6:34 am
here's teh puedocode that I currently use for something similar:
add one more column to your tracking table, a flag or field to signify "NotificationSent' or something.
now create a job that will send a notification for each row that NotificationSent = 0.
have the job send an email, and if successful, set the NotificationSent =1.
schedule the job to run every 5 minutes or so.
Lowell
January 12, 2007 at 12:38 pm
Triggers are not good but can't you create a trigger on the table for insert to send the info via db mail?
MohammedU
Microsoft SQL Server MVP
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply