|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > Ctreate Trigger Whitch checks the sysytem data and send a email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|