Solved

Controlling the flow in SQL Server Agent

Posted on 2016-08-23
1
30 Views
Last Modified: 2016-08-23
I have a SQL Server Agent job with 3 tasks.  Task 1 and task 3 will always run.  Task 2 will only run if the count of records in a specific table = 0.  How can I set up the steps to allow this?
0
Comment
Question by:thoecherl
1 Comment
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 41767725
You can't, as SQL Server Agent does not handle conditional step logic as you have described.

A workaround would be to edit the Stored Procedure / SSIS package that is called by Step 2 to test for the 'count of records in a specific table > 0', if yes do everything currently in Step 2, if no then exit.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

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