Solved

SQL SERVER 2005 Daily Job

Posted on 2007-03-27
1
233 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

822 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