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 |
learning_grsql
Posting Yak Master
230 Posts |
Posted - 2014-01-11 : 05:19:39
|
Hi,When I use the following query, it shows only dates from 1st Jan 2014 to 4th Jan 2014, but week 1 should have been 30th Dec to Jan 5th. Can you tell me where I'm doing wrong?select date from tablewhere datepart(wk,date) = 1 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2014-01-11 : 08:24:02
|
what you want is iso_weekdatepart(iso_week,date) KH[spoiler]Time is always against us[/spoiler] |
|
|
learning_grsql
Posting Yak Master
230 Posts |
Posted - 2014-01-11 : 09:45:30
|
I'm using 2005 sql server. iso_week is not a recognized option |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-01-11 : 12:39:29
|
so whats your exact requirement?to get all days in 1st week of year?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
learning_grsql
Posting Yak Master
230 Posts |
Posted - 2014-01-12 : 06:13:11
|
Hi Visakh16, I want to extract a data for 1st week of this year. My query looks like below.select date, sum(price) from tablewhere datepart(wk,date) = 1 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|