DECLARE @Date DATE = '1900-01-01',
@inc INT = 0
;with cte as
(
select @inc AS Inc,DATENAME(mm,@Date) AS [MonthName],DATEPART(mm,@Date) AS [MonthNumber]
UNION ALL
select inc+1,DATENAME(mm,DATEADD(mm,inc+1,@Date)),DATEPART(mm,DATEADD(mm,inc+1,@Date))
FROM cte
where inc < 11
)
select [MonthName],[MonthNumber] from cte
No comments:
Post a Comment