September 5, 2009 at 4:06 am
Hi All,
I have a job scheduled to run daily once at 11:00 AM. Now I have a requirement in which that job should not run on holidays i.e. on particular dates. Please assist me finding solution for the same.
Thanks
September 5, 2009 at 4:09 am
I dont think this feature is available while scheduling your job. You'll have to manually disable it/enable it OR you can create a Holidays table containing holiday dates and query this table prior to running the job. if the date matches, quit the job or else continue with execution.
September 5, 2009 at 9:39 am
I'll second that. It also makes adding "snow" and "emergency" days easy.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 5, 2009 at 10:23 am
I've typically just had a holiday table since each business handles them differently. It will allow you to easily query for any off days, as Jeff mentioned, that are specific to your business.
September 6, 2009 at 11:03 pm
HI All ,
Thanks for your reply.
Can you please assist me with the steps to achieve this solution...
September 6, 2009 at 11:31 pm
HI All ,
Thanks for your reply.
Can you please assist me with the steps to achieve this solution...
September 6, 2009 at 11:50 pm
-- Create the Holiday Table
create table tblHolidays
(
id int identity(1,1),
Holiday datetime
)
-- Insert test Holiday dates
Insert Into tblHolidays(holiday)
select (getdate()-1)
Union all
select (getdate()+2)
Union all
select (getdate()+1)
Union all
select (getdate()+10)
-- Insert this as a part of job step
if not exists(
select 1 from tblHolidays where convert(varchar,Holiday,112)=convert(varchar,getdate(),112)
)
-- Your commands here
Exec Mysp
September 7, 2009 at 4:51 am
Thanks
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply