Quantcast
Channel: Answers for "sql for day of the week in the future"
Viewing all articles
Browse latest Browse all 8

Answer by Magnus Ahlkvist

$
0
0
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)

Viewing all articles
Browse latest Browse all 8

Trending Articles