Stop a SQL job in the first 5 days of the month, but report success

It is actually quite simple when I think this through:

  1. Make the first job step with this T-SQL query:
    IF ((SELECT DAY(GETDATE())) < 6) BEGIN
      SELECT 1/0
    END
     
  2. Go to the Advanced Tab of the Job Step property page.  Select "Quit the job reporting sucess" on the "On Failure Action" drop down.

 

Note:  You can use RAISERROR, but the Severity has to be set to greater than 10.  To avoid future maintenance confusion, I decided to go with the basic fatal error generation.

Print | posted on Tuesday, February 2, 2010 1:12 PM

Feedback

No comments posted yet.

Your comment:





 

Copyright © Kevin Shyr

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski