Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index on Datetime column?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrats & ententes
Divers
Thread ID:
00469678
Message ID:
00469722
Vues:
29
>I was cleaning up my codebase the other day and noticed that more than a few people recommend indexing on ttoc() when a datetime field is concerned, instead of directly indexing on the column.
>
>I never ran into any problems with indexing on the datetime type, but I am curious why "everyone" assumes its a no-no.
>
>Thanks.

If your index is only on a data or time field, there is no need to convert it to character. To get proper ordering of a date field when combined with another field, the date field expression would be dtos(mydate). Using the dtoc() function on a date first orders by the month regardless of the year. For a datetime, you would use a second parameter -- ttoc(mydate, 1) -- which is similar to dtos() for a regular date field.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform