Ayman Ayman - 5 months ago 8
SQL Question

Query to add one month to the current month

How can add x number of months to the current month

I have tried below query but it didn't work

SELECT DateAdd(month,1,MONTH(GETDATE())) as Month


Out
put

1900-02-07 00:00:00.000

Answer

This will return the number for the next month.

select MONTH(DATEADD(MONTH, 1, GETDATE()))

Output:

7

Comments