--First Day of this Monthselect DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)

DECLARE @Year char(4) = '2014';WITH E1 AS( SELECT N FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) E(N)),E3 AS( SELECT a.N FROM E1 a, E1 b, E1 c),cteTally AS( SELECT TOP (360) DATEADD( dd, (ROW_NUMBER() OVER( ORDER BY (SELECT NULL)) - 1), CAST(@Year AS date)) myDate FROM E3),weekDays AS( SELECT myDate, ROW_NUMBER() OVER(PARTITION BY MONTH(myDate) ORDER BY myDate) rn FROM cteTally WHERE DATENAME( WEEKDAY, myDate) NOT IN ('Saturday', 'Sunday'))SELECT myDate FirstWeekDay, DATEADD(MM, DATEDIFF(MM, 0, myDate), 0) FirstDayFROM weekDaysWHERE rn = 1

DECLARE @year datetimeSET @year = GETDATE();WITHcteDigits AS ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9),cteMonths AS ( SELECT [10s].digit * 10 + [1s].digit AS month# FROM cteDigits [1s] CROSS JOIN cteDigits [10s] WHERE [10s].digit * 10 + [1s].digit BETWEEN 1 AND 12)SELECT first_day_of_month + CASE WHEN DATEDIFF(DAY, 0, first_day_of_month) % 7 < 5 THEN 0 WHEN DATEDIFF(DAY, 0, first_day_of_month) % 7 = 5 THEN 2 ELSE 1 END AS first_workday_of_monthFROM cteMonthsCROSS APPLY ( SELECT DATEADD(YEAR, DATEDIFF(YEAR, 0, @year), 0) AS first_day_of_year) AS ca1CROSS APPLY ( SELECT DATEADD(MONTH, month# - 1, first_day_of_year) AS first_day_of_month) AS ca2ORDER BY first_workday_of_month

WHEN DATEDIFF(DAY, 0, first_day_of_month) % 7 = 5 THEN 2 ELSE 1 END

declare @Year date = getdate();with TwelveCount(n) as (select n from (values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12))dt(n))select dateadd(month,n - 1, dateadd(year,datediff(year,0,@Year),0)) FirstOfMonth, datename(dw,dateadd(month,n - 1, dateadd(year,datediff(year,0,@Year),0))) NameOfDayfrom TwelveCountorder by dateadd(month,n - 1, dateadd(year,datediff(year,0,@Year),0))