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
 General SQL Server Forums
 New to SQL Server Programming
 Scheduled tasks

Author  Topic 

Ironwil
Starting Member

8 Posts

Posted - 2009-07-30 : 13:00:02
I am working on an intranet web application that managers used for tracking projects. It's been requested that an email alert be sent in the event that no updates are posted for a project within a certain span of time. Basically, they want to know if a project is sitting idle. I need a sql query to run each day to check for the LastModified value, and see if that is more than 'n' days from today. I can write basic sql queries, but I don't know how to do this.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-07-30 : 13:33:38
You can use Database Mail to send email directly from SQL Server. You can even set it up to run as a job, which is what I would recommend for this and have the job run say every 15 minutes or so.

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

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Ironwil
Starting Member

8 Posts

Posted - 2009-07-30 : 13:47:05
Thanks, but first I need to know how to create a sql query that will run each day at a certain time to yield the results. Can you point me in the right direction for that?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-30 : 13:56:04
what you need is to create a sql job in sql server agent to sent email and schedule it as per your recurrence period.


http://msdn.microsoft.com/en-us/library/ms135739.aspx
Go to Top of Page
   

- Advertisement -