SQL Agent – Environment specific workflow

I like to keep my SQL Agent jobs in sync between environments, however not all jobs need to be run in all environments.

To handle this, I’ve been using some TSQL to force a failure and end the job at a point.

Here’s the overall job

Within that, the TSQL for the ‘–Finish here if DEV–‘ step is

BEGIN
IF @@SERVERNAME = 'SQLAPP02\SQL2016_DEV'
THROW 50000, 'Dev Environment', 1
END

To control the workflow, I’m setting the on success and on failure as follows:

0 Comments

You can be the first one to leave a comment.

Leave a Comment