Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Calculating T-90 working days date?

Posted on 2009-05-06
1
Medium Priority
?
1,115 Views
Last Modified: 2012-05-06
Hi,

I have a table which holds details of business transactions. One of the fields in the table is dt_bus which is the date the business transaction occurred. Every 40 days I move transactions older than 40 days to a TRANS_ARCH table, to archive them. However, I now want to delete all transactions where dt_bus is greater the 90 working days from TRANS_ARCH (as I can retrieve these entries from tape if ever required)

How can I easly and quickly calculate the date which is 90 working days before today (ie T - 90). I don't think it's possible to include holidays so considering Mon - Fri as the working week is fine
0
Comment
Question by:bowemc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
alpmoon earned 2000 total points
ID: 24313228
I think what you need is using dateadd function:

where yourdate < DATEADD(dd,-126,GETDATE())

assuming that 90 work days is 126 (90*7/5) calendar day.

However, you can create a calendar table including all working days and use it to find exact working day as well.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read on to get a few ideas on how to promote your next corporate event.
In this article, WatchGuard's Director of Security Strategy and Research Teri Radichel, takes a look at insider threats, the risk they can pose to your organization, and the best ways to defend against them.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question