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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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