tags:

views:

439

answers:

3

I am using sql server 2005. I just want to know is there something we can get the week number for the particular month. Example Date = '2008-10-16' Is there something we can have SELECT WEEK(Date). Or any better suggestion.

A: 

SELECT DATEPART( week, '2008-10-16')

Bill
Is there a way i can get week for the month. Is gives me 42 i guess thats the week of the year.
jazzrai
+1  A: 

You can do it this way:

SET @weeksinmonth=datediff(week, @date, @lastdate) + 1

That is a copy-and-paste out of one of my stored procedures.

BoltBait
A: 

select (datepart(dd,'2008-10-08')-1) / 7 + 1

Jimmy