Mike Yearwood
Toronto, Ontario, Canada
Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Hi Tracy
Use two indexes, one for the seek and a different one for the display.
The seek index expression can be alltrim(str(skno)) and the display index expression can be PADL(ALLTRIM(STR(skno)),4,"0")
set order to tag1
seek (what the user entered)
set order to tag2
>>>>>How might one go about this?
>>>>>The field is: SkNo N(4,0)
>>>>>
>>>>>Index on SkNo Tag SkNo
>>>>>Index on STR(SkNo,4,0) Tag SkNoA
>>>>>
>>>>>Data:
>>>>> 250
>>>>> 350
>>>>> 680
>>>>>6500
>>>>>
>>>>>Letting the user type, seek on the tag SkNo requires the full number to be typed; seek on the tag SkNoA brings you to 6500 before 680. What index could be created to get to 680 first and 6500 second?
>>>>>
>>>>>Thanks,
>>>>
>>>>padl(num,width,'0') ?
>>>>Cetin
>>>
>>>Cetin,
>>>
>>>I thought about this. Wouldn't this then force the individual to type leading 0's?
>>
>>Yes, but would mean more meaningfull to them too. You could pad behind the scenes ?
>>Cetin
>
>I almost feel like I should be using LOCATE FOR AllTrim(Str(SkNo,4,0)) with the order set to the SkNo tag. I'm just wanting the incremental searches to all be approximately the same speed.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement