stepen123
Technical User
- Jan 20, 2011
- 9
I need to search between 1 and 5 NON-ADJACENT occurrences of a Varbinary field in another Varbinary field.
For example to find in which record are A,B,C and D, querying a field with
stuffAstuffstuffBstuffCstuffDstuffstuff.
Here is the real picture:
There is a Table1 (no more than 300,000 records) with a Varbinary Field1(4), created by
REPLACE ALL Field1 WITH BINTOC(RECNO()) e.g.0h80001778.
There is another Table2 (less than 600,000 records), with a Varbinary Field2 (100), where I hold several sequences of Field1, created by the concatenation of Table1.Field1,
e.g. 8000287A 80001EF9 80001E54 8000082D 800038A3 800012F4 (there are no spaces in the actual field).
I need to use ? as a wildcard char in order to find non-adjacent occurrences of Field1 in Field2, e.g.
80001EF9, 8000082D and 800012F4 (the second, the fourth and the sixth entry).
LIKE () would be the perfect solution, but unfortunately it does not support the Varbinary data type.
I’ve chosen to work with Varbinary because
- It can hold numbers above 2G in only 4 bytes,
- Unlike Integer it can create sequences AND
Question 1: Is there a better solution for keeping sequences of numbers in a field than Varbinary?
Question 2: How can I search non-adjacent Q values in a Q string?
For example to find in which record are A,B,C and D, querying a field with
stuffAstuffstuffBstuffCstuffDstuffstuff.
Here is the real picture:
There is a Table1 (no more than 300,000 records) with a Varbinary Field1(4), created by
REPLACE ALL Field1 WITH BINTOC(RECNO()) e.g.0h80001778.
There is another Table2 (less than 600,000 records), with a Varbinary Field2 (100), where I hold several sequences of Field1, created by the concatenation of Table1.Field1,
e.g. 8000287A 80001EF9 80001E54 8000082D 800038A3 800012F4 (there are no spaces in the actual field).
I need to use ? as a wildcard char in order to find non-adjacent occurrences of Field1 in Field2, e.g.
80001EF9, 8000082D and 800012F4 (the second, the fourth and the sixth entry).
LIKE () would be the perfect solution, but unfortunately it does not support the Varbinary data type.
I’ve chosen to work with Varbinary because
- It can hold numbers above 2G in only 4 bytes,
- Unlike Integer it can create sequences AND
Question 1: Is there a better solution for keeping sequences of numbers in a field than Varbinary?
Question 2: How can I search non-adjacent Q values in a Q string?