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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Task that would cause a Trigger

Author  Topic 

dfs3000my
Starting Member

9 Posts

Posted - 2008-12-31 : 01:11:23
Hi,

I am currently trying to develop my system that would send an email reminder to a user when the deadline for a particular matter is approaching. I did a bit of a research online and I realised that I will need to do some sort of a cron job. However, speaking to my mentor, he told me that I could do some sort of a task scheduling in Microsoft SQL Server 2005 that would automatically cause a trigger at a specific time or at a period of time.

I've tried Googling it up but yet, I am left confused and stuck. Can anyone enlighten me with some information regarding this problem that I am facing now? Btw, I am using ASP.NET and MS SQL 2005 Express Edition.

Thanks in advance and really appreciate those who is able to help me.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-12-31 : 01:16:03
I would do it inside a SQL job that runs semi-frequently. I wouldn't use a trigger. If you could provide more information about it, we'd be happy to write a query for you.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-31 : 02:40:43
i think you can schedule a sql agent job which will send the email. you can use sp_send_dbmail system stored procedure for sending mail.
Go to Top of Page

dfs3000my
Starting Member

9 Posts

Posted - 2009-01-01 : 22:49:37
Hi all,

Here's a simple scenario:

Users are required to fill up a certain type of questionnaire which has a deadline that is set by an administrator. Take for example the deadline is 31st January 2009. The system would do a daily task which is to check which questionnaire has not been attempted. It will then send email reminders to those users who have, say 5 more days, till the deadline is approaching.

I have managed to set up my code so that it is able to send mails but the problem that I have is the automated task that the system is required to check everyday. I hope that these information is enough. Thank you very much.

P/S: I am very new with SQL Server
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-02 : 01:17:08
Which tables have the details of questionaire and deadline. isnt it enough to write a query to populate a temp table with the deatils users who havent attempted questionaire which are near deadline. then use records in table to send mail to those users. the two parts can be configured as two steps of your sql job.
Go to Top of Page

dfs3000my
Starting Member

9 Posts

Posted - 2009-01-02 : 01:29:47
Employee ID and deadline contains in the Questionnaire table. I get what you are trying to ask me to do. Sending mails is not a problem for me but the SQL Job is as like I've said, I am very new to this. I am not sure how can I write such a SQL Job. Do you have an example?

Thanks in advance guys :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-02 : 01:55:37
http://technet.microsoft.com/en-us/library/ms187910(SQL.90).aspx
Go to Top of Page
   

- Advertisement -