Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rushmore'ing substrings
Message
From
21/01/2003 16:52:20
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00743958
Message ID:
00743998
Views:
22
>Oh, still more good to know info, thank you. We'll search for that, and related products. We don't use substring much, just this one requirement is to locate portions of strings in long product serial number strings, so it isn't really a word-by-word search, but rather a string embedded in a longer string that we need to search on.

OK, if it is for a single table and field, and you need to start at any position, I think you can do it yourself. A generic solution might require some additional work.

I would use this approach:

Let's assume your field has 30 characters.

Create a separate table, with 30 records for each record in your original table.

Fields: a link to the PK of the main table, a number (1-30), to identify the position, and a 30-character expression.

Copy the following expression to each of the 30 records:
upper(padr(substr(MyValue, i), 30))
Where MyValue is the field you want to index on, and i ranges from 1-30.

Update the secondary table automatically, with a trigger.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform