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 |
|
sparrow37
Posting Yak Master
148 Posts |
Posted - 2009-06-06 : 03:01:24
|
| Hi all,I want to send mails to people automatically after 6 days if they didnt perform an action and then delete them or keep them if they didnt perform an action in last 7 days. Do i need to check daily in my db and get list of users or do i need to check after 6 and or 7 days ?what to do with those users who have done that action so that next time after six or 7 days they are check for next days ( I mean do i need to update their date etc )Please suggest me solution to this logicRegards,Asif Hameed |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-06-06 : 09:04:53
|
| If you want to maintain a history of these actions then every time a user performs the action, insert a new row into an UserActionHistory table for that user with the date that the action was performed. If you don't care about history then you can just update a user row with the lastActionDate. A daily job can check compare the lastActionDate (or latest actionDate) with getdate() to determine if an email should be sent.Be One with the OptimizerTG |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-07 : 03:05:21
|
quote: Originally posted by sparrow37 Hi all,I want to send mails to people automatically after 6 days if they didnt perform an action and then delete them or keep them if they didnt perform an action in last 7 days. Do i need to check daily in my db and get list of users or do i need to check after 6 and or 7 days ?what to do with those users who have done that action so that next time after six or 7 days they are check for next days ( I mean do i need to update their date etc )Please suggest me solution to this logicRegards,Asif Hameed
You could configure a job which runs daily and looks for records of people who haven't performed action for 6 days and then use system sp like xp_sendmail or sp_send_dbmail to send the emails for them.You could have a status or action field in you table and update it with relevant phase like phase 1 completed (first alert for 6 days),phase 2 completed (second alert for 7 days),... or if you want to track what all alerts you had send the customer till now, then use a history table as TG suggested. |
 |
|
|
|
|
|