samedi 3 janvier 2015

DATEPART(ww,Date) with SET DATEFIRST

I´m using SQL Server 2005


I´m trying to get the week with DatePart(ww,date) function


My code



SELECT datepart(ww,'2012-01-08 00:00:00')


Return 2


But I want ...


Return 1


According with IS0-8601 and this table from this website


YEAR 2012 Week-01 From 2012-1-2 to 2012-1-8 ...


Am I wrong?


There is any trick with SET DATEFIRST 1, I´m trying without success.


Thanks for your time


Aucun commentaire:

Enregistrer un commentaire