Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can ALLTRIM on an index field cause problems?
Message
From
06/03/2001 13:36:01
 
 
To
06/03/2001 12:22:31
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00482253
Message ID:
00482360
Views:
11
>Hi Brenda.
>
>>I read that ALLTRIM on index fields can cause data corruption problems. Is this true? I have ALLTRIMs in many of my applications indexes. And some of the indexes use LTRIM RTRIM to accomplish the same thing. Is this better procedure: INDEX ON LTRIM(RTRIM(CODE_ID))+LTRIM(RTRIM(CODE))TAG ID_CODE
>
>To add to what the others said, I accomplish the same thing by padding the entire expression; for example, INDEX ON PADR(ALLTRIM(CODE_ID) + ALLTRIM(CODE), LEN(CODE_ID + CODE)) TAG ID_CODE. That way, you get the advantage of trimmed strings in the concatenated result but the entire string is padded to the maximum length so you have a consistent key length.
>
>Doug
Am I missing something here. Don't all agree at once yet. Wouldn't trimming and concatentation in this way lead to potential errors. For example,
First case-
CODE_ID = 'ABC '
CODE = 'DEF '
Second case-
CODE_ID = 'ABCD '
CODE = 'EF '
Won't the index expression of these two cases be the same?
Maybe that's the desired result.
My preference is to index the fields as they are CODE_ID + CODE
and manipulate the expressions while searching the index via SEEK, INDEXSEEK or some other command/function.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform