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 |
|
hubschrauber
Starting Member
16 Posts |
Posted - 2005-11-15 : 04:41:17
|
| Hi all,Does anybody know why SQL server gives the wrong weeknumber when I enter the following syntax in my query analyzer.select Datepart (wk,getdate())It should give week 46, but it gives 47 What is wrong ?Are the settings of SQL server wrongIt does give the correct day, month and year.Thanks in advance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-11-15 : 04:50:53
|
from BOL on DATEPARTquote: The week (wk, ww) datepart reflects changes made to SET DATEFIRST. January 1 of any year defines the starting number for the week datepart, for example: DATEPART(wk, 'Jan 1, xxxx') = 1, where xxxx is any year.
[KH] |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-15 : 05:43:34
|
| Which day of the week.. is consider to be the starting day.. For Eg here in UAE some companies starting day is Saturday where as some as sunday. so according which you need to first day .. Check for SET DATEFIRST in BOL .. And then run the query ... Hope this helps..Complicated things can be done by simple thinking |
 |
|
|
mcordewener
Starting Member
19 Posts |
Posted - 2005-11-15 : 06:10:36
|
| Hi,what do you mean by BOL.greetz,Marcel |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-15 : 07:04:29
|
| BOl meansBook online .. its the help for sql.. when you are in Query Analyser press f1 ..Complicated things can be done by simple thinking |
 |
|
|
mcordewener
Starting Member
19 Posts |
Posted - 2005-11-15 : 07:15:21
|
| Thnxgreetz,Marcel |
 |
|
|
|
|
|
|
|