question

liton avatar image
liton asked

SQL Agent move to the next step

Is there a way in sql agent job to move to the next step if the table is empty? In the first step I want to check whether the table is empty. If the table is empty then I want to move to the next step.
sql-server-agent
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mister Magoo avatar image Mister Magoo commented ·
What do you want to do if the table is not empty?
1 Like 1 ·

1 Answer

·
Grant Fritchey avatar image
Grant Fritchey answered
Sure. Just raise an error. Then, in the steps, you can have it decide what to do in the event of a failure or a success. So, if you want it to to go to the next step on a failure, but stop running on success, you make those changes in the advanced settings of the step you're working on.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.