Unix Technical Forum

Cumulative weeks

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. ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 05:07 AM
Sam
 
Posts: n/a
Default Cumulative weeks

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 05:07 AM
Hugo Kornelis
 
Posts: n/a
Default Re: Cumulative weeks

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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com