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 |
kpsqlteam
Starting Member
6 Posts |
Posted - 2009-05-22 : 09:59:35
|
i want to generate the weeks for given month in sql server as follows for month of may i have to get 1-2 as 1 week, 3-9 as 2nd week, 10-16 3rd week etc..31 as 6th week. |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-22 : 10:20:21
|
[code]declare @date datetimeselect @date = getdate()select datepart(week, @date) - datepart(week, dateadd(month, datediff(month, 0, @date), 0)) + 1[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|