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

date a week Expand / Collapse
Author
Message
Posted Tuesday, July 29, 2014 10:05 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, July 31, 2014 4:32 AM
Points: 40, Visits: 154
need date for weeks, beginning the week and end of week format. ie for week 1 week 2 week ... 52. how do I?
Post #1597381
Posted Tuesday, July 29, 2014 4:58 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 10:31 AM
Points: 926, Visits: 5,885
amadeu_j (7/29/2014)
need date for weeks, beginning the week and end of week format. ie for week 1 week 2 week ... 52. how do I?


Could you give an example of what you're trying to do? I think you can get what you want by using either a Calendar Table (pretty sure Jeff Moden wrote an article about it), or Lynn Pettis' calendar functions.
Post #1597526
Posted Tuesday, July 29, 2014 6:14 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:14 PM
Points: 35,770, Visits: 32,435
amadeu_j (7/29/2014)
need date for weeks, beginning the week and end of week format. ie for week 1 week 2 week ... 52. how do I?


What day of the week do your weeks start on? Also, what defines the first and last week of the year? The first week of the year starts on any given day of the week an average of 1 out of 7 times.

As a bit of a sidebar, you can save a whole lot of headaches if you adopt the principle of ISO Weeks which also takes care of the first and last weeks of the year as well as the differences between 52 and 53 week years.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1597535
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse