tags:

views:

30

answers:

2

How can I add months to the CURRENT_TIMESTAMP in SQL Server?

The solution probably lies in DATEADD() but this works with a date only, not a datetime.

Thanks.

+2  A: 

This works perfectly fine

SELECT DATEADD(month,1,CURRENT_TIMESTAMP)

From DATEADD (Transact-SQL)

date

Is an expression that can be resolved to a time, date, smalldatetime, datetime, datetime2, or datetimeoffset value.

astander
Tried it again and it works... there must have been something wrong somewhere else in the query. Thanks.
Gerrie Schenck
+2  A: 

The Current_Timestamp is the ansi equivalent of GetDate() in SQL, so it is perfetly acceptable to use within a DateAdd function.

select dateadd(m,3,current_timestamp)

Adds 3 months to the current timestamp.

Andrew
Thank you Andrew.
Gerrie Schenck