Is it possible to get month names between two dates in SQl
ie,
2011-05-01 And 2011-08-01 are the inputs
I just w
Inspired by Jamiec's answer, but fixing issue with with from day bigger then to day:
declare @start DATE
declare @end DATE
SELECT @start='2011-05-19' , @end='2011-08-15'
;with months (date)
AS
(
SELECT DATEADD(DAY,1,EOMONTH(@start,-1))
UNION ALL
SELECT DATEADD(month,1,date)
from months
where DATEADD(month,1,date) < EOMONTH(@end)
)
select Datename(month,date)
from months