![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I can't seem to find a way to do the following: create table part_table ( col1 int, col2 datetime ) on psX (datename(week,col2)) I want to partition based on the week number of a date field. So if I enter in data like the following in my part_table: (1, 1/1/2007) should go into partition 1 for week #1 (52, 12/21/2007) should go into partition 52 for week #52 of the year I tried adding in a computed column, but it says its nondeterministic. |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Ok, so I tried this: create table part_table ( col1 int, col2 datetime ) on psX ((datepart(dayofyear,col2)/7)+1) and I got "Incorrect syntax near '('. " select ((datepart(dayofyear,getdate())/7)+1) will give me the correct week of the year that I want. (first week starts on the first day of the year this way) |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |