General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only