Sql Get months Name between two dates in a table
- by user2219210
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 ??