Solved

SQL - Add days to working date

Posted on 2013-06-24
2
702 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

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…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

617 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