MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 4th, 2013, 09:22 AM
archive972 archive972 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 archive972 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 47 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old January 4th, 2013, 10:41 AM
gk53 gk53 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 71 gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 28 m 25 sec
Reputation Power: 8
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

Reply With Quote
  #3  
Old January 4th, 2013, 11:07 AM
archive972 archive972 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 archive972 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 47 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old January 8th, 2013, 12:07 AM
narrokk narrokk is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 31 narrokk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 42 sec
Reputation Power: 1
Quote:
Originally Posted by archive972
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.


1. gk53 has anwered one of my questions regarding triggers, and has given a fine example on how to make it just search here...


2. In my opinion, you could do your number two using DTS, in sql 2005 and up versions they are report something, DTS, or Data Transformation services provides a step by step process on how to manage SQL queries, and can even save some of your time because it has the utility for you to do it, in your problem, it has the ability to send emails

3. This is easy


HTH... or maybe i made you confused...

Reply With Quote
  #5  
Old February 5th, 2013, 09:12 AM
gk53 gk53 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 71 gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 28 m 25 sec
Reputation Power: 8
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Triggers (Beginner Questions)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap