SOUNDEX Function [String]

Returns a number representing the sound of a string.

Syntax

SOUNDEXstring-expression )

Parameters

Parameters

Description

string-expression

The string.

Returns

SMALLINT

Example

The following statement returns two numbers, representing the sound of each name. The SOUNDEX value for each argument is 3827.

SELECT SOUNDEX( 'Smith' ), SOUNDEX( 'Smythe' ) FROM iq_dummy

SOUNDEX ( 'Smith' ) is equal to SOUNDEX ( 'Smythe' ).

Usage

The SOUNDEX function value for a string is based on the first letter and the next three consonants other than H, Y, and W. Doubled letters are counted as one letter. For example:

SOUNDEX( 'apples' ) FROM iq_dummy

is based on the letters A, P, L, and S.

Multibyte characters are ignored by the SOUNDEX function.

Although it is not perfect, SOUNDEX normally returns the same number for words that sound similar and that start with the same letter.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Compatible with Adaptive Server Enterprise, except that Adaptive Server Enterprise returns a CHAR(4) result and Sybase IQ returns an integer.

Related reference
DIFFERENCE Function [String]