Monday, December 20, 2010

Sql Server: Compare two strings on basis of how they sound

This morning I need a function which can compare two of my strings and need similar strings on the basis; how they SOUND. I need this because data entry operators entered data with different spellings and spelled how they sound.
That’s what I was looking for: SOUNDEX()
USE AdventureWorks
FROM    Person.Contact
WHERE   SOUNDEX(FirstName) = SOUNDEX('Phil')

According to microsoft “SOUNDEX() converts an alphanumeric string to a four-character code to find similar-sounding words or names. The first character of the code is the first character of character_expression and the second through fourth characters of the code are numbers. Vowels in character_expression are ignored unless they are the first letter of the string. String functions can be nested.”

1 comment:

All suggestions are welcome