Click here to Skip to main content
15,917,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add one month from the current month using datepart

for the above thing i written the query as follows


select datepart(month,getdate()) as Month

when i execute the output as follows

Month
7

it is working correctly, suppose current month is December when i execute the above query

the output as follows,

select datepart(month,getdate()) as Month

Month
13

suppose current month is december,and add one month from the current month i want the output as follows,


Output i want as follows if current month is december

Month
1.


for that how can i write the sql query.

Rgds,
Narasiman P.
Posted

SQL
select datepart(month,dateadd(month,1,'20131201') ) as Month
 
Share this answer
 
select datepart(month, dateadd(month, 1, getdate())) as [month]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900