Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Best Match comparing company names in two tables

Author  Topic 

strobinson1
Starting Member

2 Posts

Posted - 2009-06-30 : 12:27:23
Hi !!

I have myself a little problem that I'm trying to solve...

I have two tables, each with a field containing company names. I want to run a comparison to see if the companies in table A are present in table B.

HOWEVER, some bright spark didn't type the names into each table the same. For example, 'UK Communications Limited' vs 'UK Communications Ltd' or 'The Telephone Company' vs 'Telephone Co.'

Basically, I want to write a piece of code that will find the closest match. I've tried to break out one table into it's individual words and try matching them on the other table but the code gets quite complex and seems to take an age to run.

Does anyone have any ideas on how best to achieve this??

Thanks !!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-30 : 13:06:24
You can use google custom search in the right above corner of this forum.
Search for: soundex
I think this can help you.

Fred


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-30 : 13:09:50
seems like what you need is this

http://sqlblindman.googlepages.com/fuzzysearchalgorithm
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2009-06-30 : 15:39:18
More recent version: http://sqlblindman.pastebin.com/f4fc1ccb5

________________________________________________
If it is not practically useful, then it is practically useless.
________________________________________________
Go to Top of Page

strobinson1
Starting Member

2 Posts

Posted - 2009-07-01 : 03:47:07
This is IDEAL ! Thanks very much !
Go to Top of Page
   

- Advertisement -