Solved

Controlling the flow in SQL Server Agent

Posted on 2016-08-23
1
35 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

730 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