Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>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.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement