Take away 5 days from a date

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
LVL 7
TRACEYMARYAsked:
Who is Participating?
 
Lee W, MVPConnect With a Mentor Technology and Business Process AdvisorCommented:
0
 
rafranciscoConnect With a Mentor Commented:
Try this:

SET @SET_PROMISE_DATE = DATEADD(DD, -(@SET_DEFAULT_INTEGRATION_DAYS), @SET_PROMISE_DATE)
0
 
TRACEYMARYAuthor Commented:
Thanks that worked.....i thought when i was typing it in its not right
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
TRACEYMARYAuthor Commented:
That will take care of leap year and year end the dateadd(dd) >?
0
 
rafranciscoCommented:
Yes, it will take care of leap years and year end.
0
 
TRACEYMARYAuthor Commented:
Thank you and for the quick speed......
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.