| Author |
Topic  |
|
|
AskSQLTeam
Ask SQLTeam Question
USA
0 Posts |
|
|
henrik staun poulsen
Starting Member
4 Posts |
Posted - 02/02/2007 : 02:27:14
|
Thank you very much for an interesting article.
Have you tried DATEADD(dd, DATEDIFF(dd, 0, ModifiedDateOnly ), 0) for calculating ModifiedDateOnly ? This way you're only doing integer arithmatic, and that may be somewhat faster?
We're have a lot of searches on the date part of datetime fields so your observations will come in handly.
Best regards, Henrik Staun Poulsen |
 |
|
|
Scott Pletcher
Starting Member
2 Posts |
Posted - 06/19/2007 : 10:23:22
|
Very interesting article. I hadn't thought about using computed index as related to case sensitive/upper/lower.
As far as a datetime search, though, I don't think it warrants the overhead of a separate index. Just index the original column, then use a range search, something like this:
-- to find all dates matching 'Jun 19, 2007'
-- (full) DATETIME only WHERE dateColumn BETWEEN '20070619' AND '20070619 23:59:59.997'
-- either (full) or SMALLDATETIME WHERE dateColumn >= '20070619' AND dateColumn < '20070620'
-- SMALLDATETIME only WHERE dateColumn BETWEEN '20070619' AND '20070619 23:59' -- this one seems risky to me, since if the column is changed to -- (full) DATETIME, that query could miss some values |
 |
|
| |
Topic  |
|
|
|