?
Solved

Take away 5 days from a date

Posted on 2005-05-10
6
Medium Priority
?
411 Views
Last Modified: 2010-03-19
Take away days from a date
i have the following
 @SET_PROMISE_DATE is set as the date i.e 5/1/2005

 @SET_DEFAULT_INTEGRATION_DAYS = 5

 @SET_PROMISE_DATE - @SET_DEFAULT_INTEGRATION_DAYS

Is that right way of taking 5 days away from the date 5/1/2005

Is this right
0
Comment
Question by:TRACEYMARY
  • 3
  • 2
6 Comments
 
LVL 97

Accepted Solution

by:
Lee W, MVP earned 600 total points
ID: 13968460
0
 
LVL 28

Assisted Solution

by:rafrancisco
rafrancisco earned 1400 total points
ID: 13968469
Try this:

SET @SET_PROMISE_DATE = DATEADD(DD, -(@SET_DEFAULT_INTEGRATION_DAYS), @SET_PROMISE_DATE)
0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13968544
Thanks that worked.....i thought when i was typing it in its not right
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13968554
That will take care of leap year and year end the dateadd(dd) >?
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13968891
Yes, it will take care of leap years and year end.
0
 
LVL 7

Author Comment

by:TRACEYMARY
ID: 13968903
Thank you and for the quick speed......
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

839 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