« GetWeekOfYear is not reliable in .NET | Main | Microsoft made me lose my virginity »

Saturday, December 22, 2007

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8342fe72c53ef00e54fae2de88833

Listed below are links to weblogs that reference Creating more SQL Server 2005 date functions:

Comments

Christian Lindholm

This post proved to be useful, even though i did not need the information for a SQL function but a WinForms application.
I did however find a small bug in your code:

SELECT dbo.YearWeek('2006-01-01') incorrectly returns 2006-52 (it should return 2005-52). This is easily corrected by a small change on row 23 in your code.
The new row 23:
if (weekNumber >= 52 && date.Value.Month == 1)

With the correction 2006-01-01 correctly belongs to 2005-52.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment