Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compound index with two integer fields
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00355330
Message ID:
00355641
Views:
16
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform