Donate SIGN UP

SQL Server 2000 Working Days

Avatar Image
TheUnderTow | 14:12 Thu 24th Aug 2006 | Technology
1 Answers
Does anybody know a statement to enable me to amend the amount of days back a query will look depending on whether it is a monday or any other day of the week - on a monday it will need to look for entries over the weekend whereas during the week it will just be 1 day beforehand (i.e. GETDATE()-1)
Gravatar

Answers

Only 1 answerrss feed

Best Answer

No best answer has yet been selected by TheUnderTow. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.
A combination of CASE .. WHEN, DATEPART and GETDATE

WHERE DateField > CASE DATEPART(dw, GETDATE()) WHEN 2 THEN DATEADD(dd, -3, GETDATE()) -- It's a Monday!
ELSE GETDATE(dd, -1, GETDATE()) -- It's another day of the week

Only 1 answerrss feed

Do you know the answer?

SQL Server 2000 Working Days

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.