Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indexing DATE fields?
Message
From
20/08/1999 01:59:01
 
 
To
18/08/1999 22:54:38
Chris Crachiolo
Blackmoor Associates Incorporated
New York City, New York, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00255114
Message ID:
00255717
Views:
24
>DTOS converts a date to a string in the format yyyymmdd, so it does sort correctly. You only have to convert numeric values (including dates) to strings for indexing when the index expression combines it with a string -- since you can concatenate a string only with another string. (For example, if you're indexing by customer ID and date.)
>
>
>>I don't remember where or why, but it was suggested that to index a date field in the expression put DTOS(datefieldname). Is that right? Why? Wouldn't that equate today 08/17/99 to "081799" which won't sort correctly?

PMFJI: If you are not using a concatenated key with a character string or need to seek using a character string, why not just use index on (datefield) tag (datefield)... Any function built into a tag expression will inevitably make it somewhat slower. DTOS() preserves the order to match a pure index on (datefield), as stated above -- so ordering is not an issue. If you do a SQL select and need to order by the (datefield) you can still keep it optimizable even if its "...order by name, datefield" if the tag is a date tag. Else, your optimization needs to use DTOS(datefield) as the ordering/seeking criteria...

HTH

Rob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform