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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 weekofyear

Author  Topic 

Ex
Posting Yak Master

166 Posts

Posted - 2005-01-18 : 19:28:01
hello all,

i was just wondering is there anyway to get the
week of year from a date?
in some other database they have a built in function

e.g

mysql> SELECT WEEKOFYEAR('1998-02-20');
-> 8

is there anything like this in sql server or anyone suggest a way to do this i would was thinking along the lines of getting the number of days past /7 but not sure if this is totally accurate

nr
SQLTeam MVY

12543 Posts

Posted - 2005-01-18 : 19:30:19
select datepart(wk,'19980220')

1 jan is always week 1 and it works using datefirst.

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

- Advertisement -