SOUNDEX( )
Topic group Related topics Example
Returns a four-character string that represents the SOUNDEX (sound-alike) code of another string.
Syntax
SOUNDEX(<expC>)
<expC>
The string for which to calculate the soundex code.
Description
SOUNDEX( ) returns a four-character code that represents the phonetic value of a character expression. The code is in the form "letter digit digit digit," where "letter" is the first alphabetic character in the expression being evaluated. The more phonetically similar two strings are, the more similar their SOUNDEX codes.
Use SOUNDEX( ) to find words that sound similar, or are spelled similarly, such as names like "Smith," "Smyth," and "Smythe." Using the U.S. language driver, these all evaluate to S531.
SOUNDEX( ) returns "0000" if the character expression is an empty string or if the first nonblank character isn't a letter. SOUNDEX( ) returns 0's for the first digit encountered and for all following characters, regardless of whether they're digits or alphabetic characters.
To compare the SOUNDEX values of two character expressions or memo fields, use DIFFERENCE( ). If you want to compare the character-by-character similarity between two strings rather than the phonetic similarity, use LIKE( ).
SOUNDEX( ) is language driver-specific. If the current language driver is U.S., SOUNDEX( ) does the following to calculate the phonetic value of a string:
Ignores leading spaces.
Ignores the letters A, E, I, O, U, Y, H, and W.
Ignores case.
Converts the first nonblank character to uppercase and makes it the first character in the SOUNDEX code.
Converts B, F, P, and V to 1.
Converts C, G, J, K, Q, S, X, and Z to 2.
Converts D and T to 3.
Converts L to 4.
Converts M and N to 5.
Converts R to 6.
Removes the second occurrence of any adjacent letters that receive the same digits as phonetic values.
Pads the end of the resulting string with zeros if fewer than three digits remain.
Truncates the resulting string to three digits if more than three digits remain.
Concatenates the first character of the code to the remaining three digits to create the "letter digit digit digit" soundex code.