Skip to content Skip to sidebar Skip to footer

T-sql Calculated Column How To Get Iso Week Number

I have this Calendar table (code below) based on the Date and then Calculated columns. The problem is that it returns me 53rd weeks because of the logic 52 * 7 = 364 so actually we

Solution 1:

In SQL Server 2008+, you can use the following:

SELECT DATEPART(ISO_WEEK, <DATE>)

The following SO question discusses other methods to derive the ISO week:

Isoweek in SQL Server 2005

Post a Comment for "T-sql Calculated Column How To Get Iso Week Number"