This procedure is independent from regions and languages.
Please note the first line with SET DATEFIRST 1
.
SET DATEFIRST 1; -- First day of the week is set to monday
DECLARE @DateFrom DateTime ='20150601', @DateTo DateTime = '20150630' ;
WITH CTE(dt)
AS
(
SELECT @DateFrom
UNION ALL
SELECT DATEADD(d, 1, dt) FROM CTE
WHERE dt < @DateTo
)
SELECT dt FROM CTE where datepart ("dw", dt) = 1;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…