Hi does anyone know how to make MS SQL server 2000 calculate the right week
number around new year ?
According to the help file, MSSQL should follow ISO8601, which ensures that
i.e. 2003 has only 52 weeks. but these two prove it wrong:
Select datepart(ww,'20 03/12/31') --(wednesday -> returns 53)
Select datepart(ww,'20 04/1/1') --(thursday -> returns 1)
Well - the weeknumber does not change in the middle of the week. Since
2003/12/31 is the third day in the week (with Datefirst set to 1, monday),
the week with the two above dates should have number 1.
Does anyone know the cause or maybe a workaround to this problem ?
Thanks in advance,
Stig Andersen
number around new year ?
According to the help file, MSSQL should follow ISO8601, which ensures that
i.e. 2003 has only 52 weeks. but these two prove it wrong:
Select datepart(ww,'20 03/12/31') --(wednesday -> returns 53)
Select datepart(ww,'20 04/1/1') --(thursday -> returns 1)
Well - the weeknumber does not change in the middle of the week. Since
2003/12/31 is the third day in the week (with Datefirst set to 1, monday),
the week with the two above dates should have number 1.
Does anyone know the cause or maybe a workaround to this problem ?
Thanks in advance,
Stig Andersen
Comment