display week number
-
hellow can any one help me in getting week number (sunday - sunday) as week in sql server query. i am using this but its not giving as sunday to sunday SELECT StartTime,DATEPART(DAY, StartTime - 1) / 7 + 1 AS theWeekWithinMonth from TT where cardid = '3344'
-
hellow can any one help me in getting week number (sunday - sunday) as week in sql server query. i am using this but its not giving as sunday to sunday SELECT StartTime,DATEPART(DAY, StartTime - 1) / 7 + 1 AS theWeekWithinMonth from TT where cardid = '3344'
Do you mean week numbers as 1-52 (or 53). In that case try:
SELECT DATEPART(WEEK, StartTime)...
If you mean day numbers 1-7 starting from sunday try:
SELECT DATEPART(WEEKDAY, StartTime)...
The need to optimize rises from a bad design.My articles[^]
modified on Thursday, January 8, 2009 7:55 AM