Pages

Thursday, September 18, 2014

How to get records who has phonetic similarity - a hidden feature in SQL SERVER TIP #49

Sometimes , It may required that you want a query who can provide you result which have phonetic similarity.

Lets understand this by example

Suppose you want to search a record whose pronunciation or phonetic sound are similar or close to then in that case you can use SOUNDEX property of  SQL SERVER which is a hidden feature and rarely used.

To understand it lets jump into the example.

Suppose you need to find records from people  table of adventureworks database whose firstname sound like “JOHN”

so to achieve this we will write following query


SELECT  FirstName,LastName
FROM Person.Person
WHERE SOUNDEX(FirstName)= SOUNDEX('John')

It will return all those records whose firstname sounds like “John”

please see below screen for more detail

soundex'

I hope it may help you somewhere.

Enjoy !!!

RJ!!

No comments:

Post a Comment