Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Wrong goal! Expand / Collapse
Author
Message
Posted Friday, February 19, 2010 2:38 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, January 5, 2012 12:33 AM
Points: 148, Visits: 93
Our goal is to get the day of the week for the date '2009-12-17' as '5' regardless of the DateFirst setting.


SET DATEFIRST lets you define, when you want your week to start.

DATEPART (dw, <date>) gets you the "day of the week" for <date>, based upon the DATEFIRST definition we just did.

NOW:

"Our goal is to get the day of the week for the date '2009-12-17' as '5' regardless of the DateFirst setting."

sounds quite ... strange:

2009-12-17 was a Thursday.

You start your week on Sunday or Monday or Friday: 2009-12-17 was a Thursday!

Now: If you start your week on Monday, Thursday is the 4th day of the week, not the 5th.

Why should you make it the 5th, when it is the 4th?
Post #868856
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse