Tim said:
Have you tested this with timings? Or are you just guessing that a
hard disk sector read will be faster than an integer division and an
array look up?
In any case, performance is a bit irrelevant if your database says
that 12/03/2009 is in October, just because the date information was
altered after the month was calculated.
Tim F
No, I have not tested it with timings. My proposition comes from
material I have read concerning query optimization. Paraphrasing from
memory: it is not recommended to have operations against a field in an
expression such as
[WHERE]
Month(MyDateField) = [constant]
Having said that I understand the dangers of calculated fields. Tho' I
didn't say so (and shame on me for this) I recognize that a table in
which the field that defines a calculated field is subject to updates is
not a good choice for this method.
I did say the technique is "sometimes useful", but I also said "can
improve performance". I should have said "may improve performance", with
appropriate caveats explained.
Best Regards,