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.”

Posted on December 20, 2010, in TSQL Tips n Tricks. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: