Sunday Monday Tuesday Wednesday Thursday Friday Saturday 1 2 3 4 5 6 7 8 9 10 11 12 13 14 .......
Declare @Month as int =2010, @Year As int =1 SELECT * from ( SELECT cast('01' AS varchar) + Number AS [CurDate], DAteName(WEEKDAY, cast('01' AS varchar) + Number) AS [MyName] FROM master..spt_values WHERE type = 'P' AND (CAST(CAST(@year AS VARCHAR) + '-' + CAST(@Month AS VARCHAR) + '-01' AS DATETIME) + Number ) < DATEADD(mm,1,CAST(CAST(@year AS VARCHAR) + '-' + CAST(@Month AS VARCHAR) + '-01' AS DATETIME)) ) k pivot ( min(CurDate) for MyName in (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday) )k1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)