Wednesday, March 21, 2012

Is it possible to conditionally skip steps in a job?

Is it possible to conditionally skip or jump steps in a job without failing a
step?
For example I don’t want to run a step if the are no records in a table.
I also need to loop based on a condition.
Sounds like a DTS package is a better choice for this type of work.
Andrew J. Kelly SQL MVP
"Dave" <Dave@.discussions.microsoft.com> wrote in message
news:742CC080-17BE-4885-AFF4-D5769DE1AC0E@.microsoft.com...
> Is it possible to conditionally skip or jump steps in a job without
> failing a
> step?
> For example I don't want to run a step if the are no records in a table.
> I also need to loop based on a condition.
>
|||Yes, you can... select the task. Right click and go to task properties ( I
could be mistaken and it might be in the workflow properties..) but you can
associate a script ( the button is on the lower left side of the dialog
box.)..
The script returns a value which indicates whether the step/task should run
or not...
Sorry I can't remember better details, and I only have Yukon installed on
this box...
Wayne Snyder MCDBA, SQL Server MVP
Mariner, Charlotte, NC
(Please respond only to the newsgroup.)
I support the Professional Association for SQL Server ( PASS) and it's
community of SQL Professionals.
"Dave" <Dave@.discussions.microsoft.com> wrote in message
news:742CC080-17BE-4885-AFF4-D5769DE1AC0E@.microsoft.com...
> Is it possible to conditionally skip or jump steps in a job without
failing a
> step?
> For example I don't want to run a step if the are no records in a table.
> I also need to loop based on a condition.
>
|||If this is with a job you can generate failure inside that step with
RAISERROR and then on job properties choose on failure go to the next step.
Other way with a job is to combine these 2 steps in one and make
a condition inside.
If this is a DTS go to the sqldts.com - there is a very good example
of skipping steps inside DTS package.
Regards.
"Dave" wrote:

> Is it possible to conditionally skip or jump steps in a job without failing a
> step?
> For example I don’t want to run a step if the are no records in a table.
> I also need to loop based on a condition.
>

No comments:

Post a Comment