Solved

SQL SERVER 2005 Daily Job

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

809 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