Sunday, October 10, 2021

Soundex in SQL Server

 Returns a four-character code (varchar) to evaluate the phonetic similarity of two strings.

Parameters:

1. character expression. An alphanumeric expression of character data.

The soundex function creates a four-character code that is based on how the character expression would sound when spoken. the first char is the the upper case version of the first character of the parameter, the rest 3 characters are numbers representing the letters in the expression (except a, e, i, o, u, h, w and y that are ignored).

Example:

SELECT SOUNDEX ('Smith') -- Returns 'S530'
SELECT SOUNDEX ('Smythe') -- Returns 'S530'


No comments:

Post a Comment