Microsoft KB Archive/97066

= How To Index a Combined Date and Character Field =

Article ID: 97066

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft FoxPro 2.0
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5b

-



This article was previously published under Q97066



SUMMARY
There are several different techniques you can use to create an index on combined Date and Character fields. The first technique illustrated below gives you a bit more flexibility in sorting. The second two are equivalent, and it is generally best to use the last example. INDEX ON STR(YEAR(dOrder)) + STR(MONTH(dOrder)) + STR(DAY(dOrder)) + cCustID ; TAG dateCust -or- INDEX ON DTOC(dOrder, 1) + cCustID TAG dateCust -or- INDEX ON DTOS(dOrder) + cCustID TAG dateCust

