SQL: First and Last Day of Next Month

The following SQL code is an example of retrieving the first day and the last day of next month:
 
-- first day of next month
SELECT dateadd(mm,0,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))

-- last day of next month
SELECT dateadd(dd,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+2,0))

 

 

 



   

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading