SET DATEFIRST 1
DECLARE @dt DATE
SET @dt = '2011-05-13'
SELECT DATEADD(day,
CASE
WHEN datepart(weekday,@dt)<2
THEN 2-datepart(weekday,@dt)
ELSE 9-datepart(weekday,@dt)
END,
@dt)
↧