Adding a month to a date in T SQL

38

How can I add one month to a date that I am checking under the where clause?

e.g.:

select *
from Reference
where reference_dt + 1 month

This question is tagged with sql sql-server tsql datetime

~ Asked on 2011-11-01 13:50:01

The Best Answer is


76

select * from Reference where reference_dt = DateAdd(month,1,another_date_reference)

~ Answered on 2011-11-01 13:51:35


17

Look at DATEADD

SELECT DATEADD(mm, 1, OrderDate)AS TimeFrame

Here's the MSDN

In your case

...WHERE reference_dt = DATEADD(MM,1, myColDate)

~ Answered on 2011-11-01 13:51:40


Most Viewed Questions: