This is a discussion on Cumulative weeks within the SQL Server forums, part of the Microsoft SQL Server category; --> SQL Server 2000 SP3 Hi, How can I get the cumulative weeks from a givedate to the current date. ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| SQL Server 2000 SP3 Hi, How can I get the cumulative weeks from a givedate to the current date. I know I can get the weeknumber by using datepart(wk,getdate()) but this will give me the week number for this year. What if I want to know the number of weeks that have passed since june 1 2001. If I use datepart(wk,'20010106') I will get the week number for 2001 but I would like the number of weeks expired between then now. Thanks, Reg |
| ||||
| On 2 Sep 2004 10:01:12 -0700, Sam wrote: >SQL Server 2000 SP3 > >Hi, > >How can I get the cumulative weeks from a givedate to the current >date. I know I can get the weeknumber by using datepart(wk,getdate()) >but this will give >me the week number for this year. What if I want to know the number of >weeks >that have passed since june 1 2001. If I use datepart(wk,'20010106') I >will >get the week number for 2001 but I would like the number of weeks >expired between then now. > >Thanks, > Reg Hi Reg, select datediff(week, '20010106', getdate()) ----------- 191 By the way - '20010106' is january 6, not june 1.... Best, Hugo -- (Remove _NO_ and _SPAM_ to get my e-mail address) |
| Thread Tools | |
| Display Modes | |
|
|