January 4th, 2013, 09:22 AM
Triggers (Beginner Questions)
I'm new to work with SQL and though I've learned querying and a few small stored procedures I have an issue I need to try and resolve. So here is the scendario:
I have 3 email fields in my database that I would like to send an email out too whenever one of the fields in my database changes.
For example: when (Site_Status) field changes email the 3 emails in the record i'm updating (sales_email, Site_email, Management_email). I was told to do this through an application layer which I will implement at a later time, but for now I need some kind of trigger that I can use. I know triggers can be cumbersome and unreliable but at this time it's my only option. I will be using DBmail to email out these message updates. Thanks for your help.
January 4th, 2013, 10:41 AM
I would set table foe emails needs to be send and separate this process to steps.
1. Trigger changes (set triggers) and add records to table with changes
2. set stored procedure which read records from table with changes, send emails and market them asp processed.
3. run that stored procedure as SQL job on schedule
January 4th, 2013, 11:07 AM
The only problem is I'm not familiar with all these steps. Are you suggesting to put these emails into a separate table all together? I could do that without any problems. But the rest of the steps I don't know how to do.
January 8th, 2013, 12:07 AM
February 5th, 2013, 09:12 AM
Which part you do not know?
How to create trigger?
How to send email from SQL server?
How to create stored procedure?
How to schedule stored procedure execute on server?