Link to home
Start Free TrialLog in
Avatar of atljarman
atljarman

asked on

Date 30 business days in future MS SQL

I have a table in my database called holidays with the federal holidays in it.  I need to add a column in another table that is a calculated date value of what is 30 business days in the future.  I know there is a lot out there on this but I need some assistance on asking our DBa admin to set this up.
ASKER CERTIFIED SOLUTION
Avatar of atljarman
atljarman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
by the way, if you do build a calendar table you may want to keep it and maintain it in a 'utility database' so you don't need to replicate it in many locations - but that's really up to you of course.
My table too contains only non-work days, but it has ALL non-work days, including weekends, holidays (even those that "move"), plant shutdowns, whatever.

Then I use a scalar function to return +/- (0 to ~60) business days from a given date.

[Actually, I have *two* non-work-related date tables: a *control* table with non-work dates "definitions" and the dates table itself.  The control table is modified as needed, then the actual data table rows are (re)generated on demand by a proc for the date range specified.  This makes it both very easy to customize non-work days by customer (which is 100% required for us) and much easier to generate many future years' worth of non-work days.]

If you want details / actual code for that, let me know.
Avatar of atljarman
atljarman

ASKER

Did not completely anwser my question yet the walkthough was helpful.