Sql Get months Name between two dates in a table

Posted by user2219210 on Stack Overflow See other posts from Stack Overflow or by user2219210
Published on 2014-06-09T09:20:41Z Indexed on 2014/06/09 9:24 UTC
Read the original article Hit count: 199

Filed under:
|
|

My Table column (ID , startDate , EndDate )

I need to use this way with every row of the table :

not with a specific value like :

declare @start DATE = '2011-05-30'
declare @end DATE = '2011-06-10' 

;with months (date) AS ( SELECT @start UNION ALL SELECT DATEADD(month,1,date) from months where DATEADD(month,1,date)<= DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@end)+1,0)) ) select Datename(month,date) from months

it possible ??

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server