Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 schedule job on the last working day of every mon

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2010-06-30 : 16:37:41
hi friends ,

is there a way to schedule an sql job on the last working day of the month
i.e it should run on Monday thru friday which ever is earleir and is last working day....

i.e in june 30 is last working day and its wednesday so the job should run today in july 31 is last working day but its a sunday then it should check 30 which is saturday then it should check 29th which is a friday and working day so the job should run on this day for july

Hope i am clear about what i want..thanks in advance

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-06-30 : 16:49:03
what if it is a holiday do you still want it to run? you might look into a calendar table, maybe

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2010-06-30 : 16:52:36
yes that should exclude holidays but that can be secondary(not so important).....
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-06-30 : 17:22:20
I would strongly suggest you create a calendar table then just query that table using BusinessDayYesNo field and/or LastBusinessDayYesNo, HolidayYesNo type of fields. if you search in this forum there have been posts explaining how to create a calendar table.

<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -