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

Answer by siera_gld

all of the time - so it should not matter if it's thur or friday at the time the query id executed, tue should be the return date.

View Article


Answer by Squirrel

simplest way without complicated arithmetic operations is declare @dte date select @dte = '2011-10-17' select dateadd(day, case datename(weekday, @dte) when 'Sunday' then 2 when 'Monday' then 1 when...

View Article


Answer by Magnus Ahlkvist

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)

View Article

Answer by DannyC

I know this is very late, but I was looking for the same answer today and found this: select getdate(),dateadd(week, datediff(week, 0, getdate()), 9) I am including GetDate() in the results only to...

View Article

Answer by siera_gld

all of the time - so it should not matter if it's thur or friday at the time the query id executed, tue should be the return date.

View Article


Answer by Squirrel

simplest way without complicated arithmetic operations is declare @dte date select @dte = '2011-10-17' select dateadd(day, case datename(weekday, @dte) when 'Sunday' then 2 when 'Monday' then 1 when...

View Article

Answer by Magnus Ahlkvist

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)

View Article

Answer by DannyC

I know this is very late, but I was looking for the same answer today and found this: select getdate(),dateadd(week, datediff(week, 0, getdate()), 9) I am including GetDate() in the results only to...

View Article

Browsing all 8 articles
Browse latest View live