Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rajan.nithin
Starting Member
42 Posts |
Posted - 2011-11-03 : 07:03:36
|
Hi,I need to send mails using Database mail to clients whose balance is less than $2000 .Say I need to schedule the first reminder for clients whose balance is less than $2000 at 0900 hrs & than later in the evening i need to send reminder for clients if the balance is less than $2000 at 1800hrs. Now the issue is that if the client has been sent an email in the morning then he should not receive the mail in the evening.The table fields are :clientidclientnameemailbalanceamountHow can I do this ?Regards,Nithin |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-03 : 07:28:07
|
add a job in sql agent for sending mail. add a table for tracking emails sent with time and clientid. the job will be run twice. each time it runs check it against the tracking table and make sure no record exists for same clientid same day and then send email to avoid sending more than once------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
rajan.nithin
Starting Member
42 Posts |
Posted - 2011-11-03 : 07:50:35
|
How can I go about creating a tracking table & executing your idea. Is there any documentation for the same. Sorry for troubling you again.quote: Originally posted by visakh16 add a job in sql agent for sending mail. add a table for tracking emails sent with time and clientid. the job will be run twice. each time it runs check it against the tracking table and make sure no record exists for same clientid same day and then send email to avoid sending more than once------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-03 : 08:01:44
|
nope no documentation as suchtracking table will be just a simple CREATE TABLE... statement with clientid,date and maybe status field. SQL agent job can be added to have step which calls sp_send_dbmail to send the mail------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
rajan.nithin
Starting Member
42 Posts |
Posted - 2011-11-04 : 09:24:57
|
Thanks a looooooot Visakh for the timely help!!quote: Originally posted by visakh16 nope no documentation as suchtracking table will be just a simple CREATE TABLE... statement with clientid,date and maybe status field. SQL agent job can be added to have step which calls sp_send_dbmail to send the mail------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
 |
|
|
|
|