user2162617
user2162617

Reputation: 1

SQL Server Job Dependency

I have a job in SQL Server 2000 which runs every night and refreshes the data, I have another job which runs after the data refreshes and update some records. Both of these jobs are not connected to each other. I need to know how can I stop or disable the update job if the data refresh job fails.

Upvotes: 0

Views: 1436

Answers (1)

Garrett Vlieger
Garrett Vlieger

Reputation: 9494

You can do this through a simple data flag that indicates the status of the job. For example, create a table that has the following columns:

  • JobID
  • StartTime
  • EndTime
  • Status

In the first job, write a new record when the job starts and then set the Status flag when it completes to indicate success. Next, when the second dependent job is run, have it check the Status flag for the same date to determine whether the previous job completed. If it hasn't completed (i.e., Status <> 'Done'), do not start the job.

Hope this helps.

Upvotes: 1

Related Questions