April 10, 2006 at 4:04 am
April 10, 2006 at 4:50 am
Hi Karthi,
set
datefirst 1
Select
getdate() - (datepart(dw,getdate())-1), getdate() + 7 - (datepart(dw,getdate()))
April 11, 2006 at 3:48 am
Edit: Nevermind.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 11, 2006 at 6:48 am
What day of the week do you consider the first day of the week to be?
--Jeff Moden
Change is inevitable... Change for the better is not.
April 11, 2006 at 2:46 pm
GilaMonster,
How does your DateWeekEnds function work? Suppose I'm using the SQL Server 2000 defaults and @@DATEFIRST=7 (Sunday). If today is a Monday and I pass in today's date, the return value evaluates like:
dateadd(day, 7 - 1 + 4, <today's date> or 10 days from today. Thanks for any insight you can provide.
Steve
April 11, 2006 at 11:48 pm
Apparently they don't.
Sorry, I wrote those a while back and they did work then. Haven't used them in ages. Will check.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply