How to implement a batch process or job in SQL Server?
-
Friday, April 13, 2012 10:07 PM
Hi All
Let me explain a little bit what I would like to do.
- There is a SQL Server DB with some tables
- Form an ASP.Net web application the user can interact with the data in the tables.
- For the purpose of this post, in that DB there is a table where the user can add, delete and update some tasks.
- Now, based on that table and those tasks, there is a requirement where I need to send some notifications mails when a task is going to expired (when the deadline of the task is first less than 10 days and second less than 5 days.
Based on the described above, how can I do it? I have been working with SQL Server 2005, however I haven't had the opportunity to do something like this.
In SQL Server 2005, will this be achieved using SSIS? or will I need to create the batch process in C#?I know that this will be doing with Windows workflow Fundation, but at the momment I'm working with the Framework 2.0 and as mentioned with SQL Server 2005.
Any help, clue or suggestion would be very helpful
Thanks in advance
All Replies
-
Friday, April 13, 2012 10:37 PMModeratorThe simplest way (IMHO) will be scheduling a SQL Server job that will send e-mail notifications when the task is expired.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog -
Saturday, April 14, 2012 12:46 AMModerator
Adding to Naomi's note.
You can schedule the job to run every night at 2:10 am for example.
Best to put the logic into a stored procedure. Put the stored procedure execution into a job step.
Send email article:
Sending SMTP Mail using a Stored Procedure
Kalman Toth SQL SERVER & BI TRAINING
- Edited by Kalman TothMicrosoft Community Contributor, Moderator Saturday, April 14, 2012 12:47 AM
- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Sunday, April 15, 2012 2:06 AM
- Marked As Answer by Lesthad Monday, April 23, 2012 3:58 PM
-
Saturday, April 14, 2012 4:24 PM
Please check http://blog.sqlauthority.com/2007/06/27/sql-server-running-batch-file-using-t-sql-xp_cmdshell-bat-file/
It may help you.
- Marked As Answer by Lesthad Monday, April 23, 2012 3:58 PM

