ms sql leads deduplication

i have 30k records of leads (companynames,contact names, zip, state, city,phone) which may have duplications. what is the best to find duplication in my SQL database. ( in older goldmine there was duplicate finder where you can set weight to every field say Conact Name - 10, zip - 5 , city 5, company name 10, phone number 10  and let us say if sum is 20 on when compare two records they will be duplicate suspect)
I am looking for a similar script which will help deduplicate
leop1212Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
You can only look for identity or you may use SOUNDEX(), which only works for US names. Another approach would be using a edit metric like Levenshtein.
Levehnshtein.sql

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dsackerContract ERP Admin/ConsultantCommented:
Hi Leop1212. You may want to compare those fields for duplication very much like the other thread you have going, in particular, post ID 40854691 there.

Change the table name(s) and field names as needed. Perhaps something like this:

SELECT  company,
        contact_name,
        city,
        state,
        REPLACE(REPLACE(REPLACE(Zip, '-', ''), ' ', ''), '.', '') AS zip,
        REPLACE(REPLACE(REPLACE(REPLACE(Phone, '-', ''), '(', ''), ')', ''), ' ', '') AS phone,
        COUNT(1) AS dupeCount
FROM    YourTable
GROUP BY company,
        contact_name,
        city,
        state,
        REPLACE(REPLACE(REPLACE(Zip, '-', ''), ' ', ''), '.', ''),
        REPLACE(REPLACE(REPLACE(REPLACE(Phone, '-', ''), '(', ''), ')', ''), ' ', '')
HAVING COUNT(1) > 1
ORDER BY dupeCount DESC

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.