Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calculating T-90 working days date?

Posted on 2009-05-06
1
Medium Priority
?
1,118 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

972 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