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
 General SQL Server Forums
 New to SQL Server Programming
 Starting Date for Week of Year

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-10-25 : 11:28:44
Can I specify a starting date like 01/01/2011 and calculate the week of the year from that?

So when 01/01/2012 comes around the week of the year will be 53 instead of 1 again?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-10-25 : 11:37:30
DATEDIFF(wk,'20110101',getdate())
Need to be careful about the start date though as it counts week boundaries rather than complete weeks.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Vack
Aged Yak Warrior

530 Posts

Posted - 2011-10-25 : 11:39:42
you are a genius. Thanks
Go to Top of Page
   

- Advertisement -