Sunday, March 11, 2012

Conditional Running of DTS Jobs

We have several DTS packages run as SQL Agent jobs using DTSRUN methods.
However, there are certain specific holidays we don't want to run these jobs
that are stored in a holiday table. Since parameters can't be passed between
job steps, what is the best way for aborting the job on a specific day
without running the DTS job? Is there a way to set a success or failure flag
in jobs and use this flag to abort before running the next job step?
Larry Menzin
American Techsystems Corp.
Couldn't you check your holiday table in each job step, using sql...for
example...
/*get today*/
select @.today = (select getdate())
/*if today isn't in the holiday table then kick off dts job*/
if not exists (select * from holiday_table where holiday = @.today)
xp_cmdshell 'dtsrun .....blah, blah'
Not sure if my syntax is quite right, and not sure how your dates are
formatted, but something like this should work.
|||You could also create a job step as the first step, that checks the date and
fails the job.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Larry Menzin" <LarryMenzin@.discussions.microsoft.com> wrote in message
news:624FC617-C35C-4FDF-95F9-D31C5349C85D@.microsoft.com...
> We have several DTS packages run as SQL Agent jobs using DTSRUN methods.
> However, there are certain specific holidays we don't want to run these
> jobs
> that are stored in a holiday table. Since parameters can't be passed
> between
> job steps, what is the best way for aborting the job on a specific day
> without running the DTS job? Is there a way to set a success or failure
> flag
> in jobs and use this flag to abort before running the next job step?
> --
> Larry Menzin
> American Techsystems Corp.

No comments:

Post a Comment