SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Checking if key job is enabled
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

druer
Constraint Violating Yak Guru

USA
314 Posts

Posted - 04/21/2006 :  13:37:34  Show Profile  Reply with Quote
Ever have one of those days where you are working on a database and disable jobs until you are finished. A month later you realize that you weren't doing something that you should have been? I wrote the following script after realizing that another system administrator had disabled a key job "temporarily" and then forgot to turn it back on. The script simply checks the sysjobs table for a key job name that you give it and will email you if that job gets disabled for any reason.

declare @enabled as integer
select @enabled = enabled from msdb..sysjobs where name = '[Daily] ServerName Nightly Backup/Maintenance'
if @enabled = 0
begin
	exec master..xp_sendmail @recipients = 'email.goes@here', @subject = '**  Nigthly backup job is not enabled **', @message = 'This is to inform that for whatever reason the nigthly backup job for SERVER NAME that should be enabled has been disabled and will not be executed tonight'
end
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000