There is no "Last business day of the month" option in SQL
Server job schedular. What is the best way to achive
this '. Is there any code out there to get this '
Thanks.Todd wrote:
> There is no "Last business day of the month" option in SQL
> Server job schedular. What is the best way to achive
> this '. Is there any code out there to get this '
> Thanks.
Calculate the first day of the next month by adding a month to the
current month, using Day 1, and using the year as it returned from the
add of the month. Then dateadd a -1 day and you are on the last day of
the current month. In a loop, check the day of the week using
datepart(dw,...) and if Sat or Sun keep subtracting one day until you
find the correct day.
A calendar table would also be useful here as it could be used to hold
holidays as well.
David Gugick
Imceda Software
www.imceda.com|||Are holidays considered a business day?
Jeff
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:0ed701c4bab8$33015290$a501280a@.phx.gbl...
> There is no "Last business day of the month" option in SQL
> Server job schedular. What is the best way to achive
> this '. Is there any code out there to get this '
> Thanks.|||http://www.aspfaq.com/show.asp?id=2519
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Todd" <anonymous@.discussions.microsoft.com> wrote in message
news:0ed701c4bab8$33015290$a501280a@.phx.gbl...
> There is no "Last business day of the month" option in SQL
> Server job schedular. What is the best way to achive
> this '. Is there any code out there to get this '
> Thanks.
No comments:
Post a Comment