Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 1st, 2003, 05:52 AM
shooteronline shooteronline is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 shooteronline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ctreate Trigger Whitch checks the sysytem data and send a email

Hi,,

I have databse table whitch has expre data. I want to compare system data with the expire data and if the expire data less than 30 days i want to send a email. I think i have to this using triggers. But i do not no lot of things about treigger. Pease help me


Regards
shooter



Reply With Quote
  #2  
Old August 6th, 2003, 10:21 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
a trigger will only be executed when either a insert takes place, or a delete or an update. It seems to me you would like to make some kind of warning system which checks expiration on a regular basis.

For these things it is better to create a DTS package and schedule it to run it periodically. Here a tutorial on DTS and what you can do with it. http://www.devguru.com/features/tutorials/DTS/DTS1.html

Hope this helps,
__________________
- Rogier Doekes

Reply With Quote
  #3  
Old August 6th, 2003, 10:10 PM
shooteronline shooteronline is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 shooteronline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for try to help me. I also found out using trggier we can not di that. Best is to use DTS package. But I have tille know ledge in DTS. I do not how to write sql progamme whitch does the work. I went througgh the article u ask to follow me.But it is little bit confuse me. Becasue i do not knoe how send mails usimng sql server


Please can u give me the more help about this?

Ragards
shooter

Reply With Quote
  #4  
Old August 11th, 2003, 06:36 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
When you use DTS and the SQL server has IIS installed, you can use the CDONTS.NewMail object to send mail.

You can create an Active X task which instantiates a CDONTS.NewMail object, sends the mail

Another way to send email is to use an extended stored procedure. I use xp_smtp_sendmail and it works great:
http://sqldev.net/xp/sp_smtp_sendmail.htm

Reply With Quote
  #5  
Old August 13th, 2003, 01:04 AM
shooteronline shooteronline is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 3 shooteronline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi

Thanks for helping me. Script is working fine. Now I want send a mail all the customer who has got there membership expired.In my PC Windows 2000 advance sever is running with sql server 2000 sever. I have email account which is configure to send and resive mail using out look express. First teach me how to configure sql sever to send mail . Then simply the result I got form above script according to that I want to send a email to client his membership got expire. Please teach me how do this?

shooter

Reply With Quote
  #6  
Old August 13th, 2003, 02:26 AM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
for the benefit of all, we are talking about the following script.

THere is a table [customer] wich customerId, Name and expiration_date. Shooteronline wanted to select all the records for which the expiration_date is 30 days of more from the system date;
Code:
 
SELECT customerID, name 
FROM    customer 
WHERE DATEDIFF(dd, expiration_date, GETDATE()) >= 30

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Ctreate Trigger Whitch checks the sysytem data and send a email


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT