Solved

Calculating T-90 working days date?

Posted on 2009-05-06
1
1,091 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 500 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sybase - CronJob schedule 2 582
Sybase SQL Syntax 2 272
How do I get Sybase ASE to throw an error that Java can catch? 4 486
MS SQL Linked server 3 117
A procedure for exporting installed hotfix details of remote computers using powershell
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now