Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 53 weeks in 2008 ?

Author  Topic 

jeffbond
Starting Member

16 Posts

Posted - 2009-01-16 : 12:34:42
Hi,

I have a query that group by year and week number :

select convert(char(4),mydate,120) as year, datepart("ww",mydate) as week, sum(value)
where mydate < dateadd("ww",-6,getdate())
group by convert(char(4),mydate,120), datepart("ww",mydate)

and it gives me weeks 49, 50, 51, 52, 53, 1, 2

53 weeks ?!

What is the week range dates for week 53? and what is the week dates range for week 1 (the following week)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-16 : 12:47:06
http://wiki.lessthandot.com/index.php/ISO_Week_In_SQL_Server
Go to Top of Page

jeffbond
Starting Member

16 Posts

Posted - 2009-01-16 : 13:12:24
Thanks. So I learnt that ISO week is only supported from sql server 2008 ..

I am not interested in ISO weeks right now, I just need to know the sql server 2000 interpretation:

so what is the dates range for week sql server2000 week 53 of year 2008 and week 1 of 2009?

cheers
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-16 : 13:25:46
can you post back the result of below

SELECT @@DATEFIRST
Go to Top of Page

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2009-01-16 : 15:32:34
quote:
Originally posted by jeffbond

Thanks. So I learnt that ISO week is only supported from sql server 2008 ..

I am not interested in ISO weeks right now, I just need to know the sql server 2000 interpretation:

so what is the dates range for week sql server2000 week 53 of year 2008 and week 1 of 2009?

cheers



Its not how SQL server interprets Week 53, it's how your organization interprets.

SQL Server's week 53 starts the last Sunday of 2008 which is 12/27/2008 ends the last day of 2008 - 12/31/2008 Wednesday.

Week 1 of 2009 starts the 1st day of 2009 - 1/1/2009 Thursday and ends the first Saturday of 2009 1/3/2009
Don't limit your business rules based on technology.

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-16 : 23:37:25
quote:
Originally posted by hanbingl

quote:
Originally posted by jeffbond

Thanks. So I learnt that ISO week is only supported from sql server 2008 ..

I am not interested in ISO weeks right now, I just need to know the sql server 2000 interpretation:

so what is the dates range for week sql server2000 week 53 of year 2008 and week 1 of 2009?

cheers



Its not how SQL server interprets Week 53, it's how your organization interprets.

SQL Server's week 53 starts the last Sunday of 2008 which is 12/27/2008 ends the last day of 2008 - 12/31/2008 Wednesday.

Week 1 of 2009 starts the 1st day of 2009 - 1/1/2009 Thursday and ends the first Saturday of 2009 1/3/2009
Don't limit your business rules based on technology.




wont this depend on datefirst setting?
Go to Top of Page
   

- Advertisement -