Like this?DECLARE @Year SMALLINT = 2012;WITH cteSource(theDate)AS ( SELECT DATEADD(MONTH, 12 * @Year - 22800, Number) AS theDate FROM master.dbo.spt_values WHERE Type = 'P' AND Number BETWEEN 0 AND 365)SELECT DATEPART(MONTH, theDate) AS theMonth, MIN(theDate) AS FromDate, MAX(theDate) AS ToDate, ROW_NUMBER() OVER (PARTITION BY DATEPART(MONTH, theDate) ORDER BY MIN(theDate)) AS WeekNumFROM cteSourceWHERE DATEPART(YEAR, theDate) = @YearGROUP BY DATEPART(MONTH, theDate), DATEDIFF(DAY, '18991229', theDate) / 7 * 7
N 56°04'39.26"E 12°55'05.63"