General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
I feel stupid asking this but I have to. I know what ALLTRIM() is. I know what TRIM() is as well as LTRIM(),RTRIM(), and the various PAD functions.
What is ALLTRIM(), TRIM
Do you mean ALLTRIM(TRIM())?
I have many times use LTRIM(TRIM(firstname) + ' ') .... to add a trailing blank to the trimmed first name only if the firstname is not empty.
>The ALLTRIM(), TRIM is ignored in the index, as I think J. Booth pointed out to me some years ago.
>If you SET EXACT ON and SEEK ("Koziol") with an INDEX ON TRIM(Name), you get no match.
>If you SET EXACT ON or OFF and have an index on ALLTRIM(Name) and do a
>SEEK(PADR("Koziol",x)), assuming I added the right number of spaces, it IS found.
>Don't ALLTRIM(), TRIM in INDEX expressions. It's pointless.
>
>>Hi Charlie ---
>>
>>No they are not; something else must be going on. For example, if I have an index on TRIM(lastname) and then SEEK "Koziol" there shouldn't be a problem. Perhaps you are using UPPER or LOWER in the index expression or in the SEEK expression?
>>
>>
>>>
>>>If I have an index on some field and the expression I'm searching for using SEEK() has leading or trailing blanks, I don't get a match. If I try an alltrim on the search expression and the index key, I still don't get a match. I appears that TRIM commands are ignored in index expressions.
>>>
>>>Charlie
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