How do I add months to a CURRENT_TIMESTAMP in SQL?

后端 未结 3 1035
生来不讨喜
生来不讨喜 2021-01-01 16:35

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.

3条回答
  •  别那么骄傲
    2021-01-01 17:15

    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.

提交回复
热议问题