Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compound index with two integer fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00355330
Message ID:
00355641
Vues:
17
>>Let me clarify my previous post. In this case you would use:
>
>>INDEX ON BINTOC(field1) + BINTOC(field2) TAG tagname
>
>Thanks George for the interesting answer.
>It cerntainly worked. I just never thought about converting them to binary.
>Will it be as fast as the str() function?

First, it's probably faster. If you use the STR() function to convert, it's going to yield 10 characters. If you're going to pad them with leading zeroes, you'll also have to have to call PADL(). BINTOC(), however, yields a string of a maximum of four characters. So right there, without the the call to PADL(), you're using 60% less characters, etc.

Second, it's not really a binary conversion. Rather it converts the integer to a four character string representation of the binary value.

BINTOC() (and CTOBIN(), which converts it back), I believe, were created for exactly this sort of usage.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform