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.
| Author |
Topic |
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-05-05 : 05:57:47
|
| How can i get the Week Number of the year....as if the date is like this ,,,2009-03-23then the week number for this date is 13 so how i can get the week number for that.Thanks..iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2009-05-05 : 06:00:47
|
| use :select Datepart(ww,'2009-03-23')malay |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-05-05 : 06:21:20
|
| SELECT DATENAME(w,'2009-03-23') AS 'WeekDay',DATEPART(dw,'2009-03-11') AS 'WeekdayInMonth',DATEPART(wk,'2009-03-23') AS 'WeekNumber' |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-05-05 : 06:22:34
|
| ok Thanks for the support now i write query like this,,,,select (datediff(dd,'17530108','2009-03-23')%7)+1, datepart(year,'2009-03-23'), Datepart(ww,'2009-03-23')It gives me results in three columns...col1 col2 col31 2009 13now i want that result like this...col12009131Thanks...iF theRe iS a wAy iN tHen theRe iS a wAy oUt.. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-05-05 : 06:39:06
|
| select CONVERT(VARCHAR(4),datepart(year,'2009-03-23')) +CONVERT(VARCHAR(4),Datepart(ww,'2009-03-23'))+CONVERT(VARCHAR(4),(datediff(dd,'17530108','2009-03-23')%7)+1) |
 |
|
|
|
|
|
|
|