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.
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.
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.
add_months(Tablename,No.of months)