Solved

SQL - Add days to working date

Posted on 2013-06-24
2
666 Views
Last Modified: 2013-06-25
I'm looking at trying to add working days to a date in sql.  Since our date never are in a weekend, I would like to add 4 days to a working date, but do not want it to fall within a weekend.

How would I write the query to do this?

Example:
Date = 5/1/2013
Working Day = 4

Output: 5/7/2013
0
Comment
Question by:holemania
[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
2 Comments
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 total points
ID: 39273143
Was going to put together a query but did a google search first and found this:

http://stackoverflow.com/questions/5471524/add-business-days-to-date-in-sql-without-loops

Several different variations presented there.  Give them a try.
0
 

Author Closing Comment

by:holemania
ID: 39275211
Thanks.  I saw that as well when searching for it, but couldn't get the last one to work.  Just played with everyone of them until I got one to work.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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