Solved

SQL SERVER 2005 Daily Job

Posted on 2007-03-27
1
214 Views
Last Modified: 2007-03-27
Hello -how would I set up to run this script everyday at 8:00am on a SQL Server 2005

Thanks JK




IF EXISTS (SELECT 1 FROM Settlement WHERE
DateStampTxt <= CAST(CONVERT(varchar,GETDATE() -1, 112) AS DATETIME) and Sitetxt = 2 and PrimaryKey = (Select Max(PrimaryKey) from Settlement where SiteTxt=2))
BEGIN
declare @body1 varchar(100)
set @body1 = ' ELLENGTON HAS NOT SUBMITED A NIGHT AUDIT'
EXEC msdb.dbo.sp_send_dbmail @recipients='test@test.com',
    @subject = 'Night Audit',
    @body = @body1,
    @body_format = 'HTML';
END
0
Comment
Question by:fsuedu
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 18801217
you need to create a job for this purpose

http://msdn2.microsoft.com/en-us/library/ms186273.aspx
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now