Solved

How do I write a SQL query that will find misspellings of names or similar names?

Posted on 2008-06-11
4
258 Views
Last Modified: 2010-04-21
I have a SQL database with two tables. One table called tblConflict has a field called conflict number, Plaintiff and Defendant.  The second table called tblConflict attorney has the link field conflict number and the name of the attorney.  I have all of it linked together with a view.  I want to be able to search for a name in the 3 columns ie Dorfman.  It might be in the database as Dorfman, Dorphman, Dorman, or Dorphmen depending how the user entered originally.  I need when you enter Dorfman that all four entries come up.
0
Comment
Question by:rphilipson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:NIMTUG_Simon
ID: 21765006
You have to use SQL Server Full text Searching and use the special search capibilities that once it is installed and configured it will return Dorfman and if you want the words that it thinks it is close to.
0
 

Author Comment

by:rphilipson
ID: 21765294
I have tried Freetext and it doesn't do it.  Also, I have two tables that the view joins.  I don't think that any of the Fulltext Search capabilities span more than one table.  I might be mistaken but I can't find anything.  Perhaps if you have a SQL statement that will work you can enlighten me.

Thanks
0
 
LVL 3

Accepted Solution

by:
NIMTUG_Simon earned 125 total points
ID: 21766484
Try the SOUNDEX  DIFFERENCE funcations

http://support.microsoft.com/kb/100365
http://msdn.microsoft.com/en-us/library/ms187384.aspx
http://msdn.microsoft.com/en-us/library/ms188753.aspx

What you have to do is to find the SoundEx value of Dorfman and The other deriatives You can get a simularity value by using DIFFERENCE.

assuming @Search is the name you are searching on.

Select Name, SoundEx(Name) as SoundValue, DIFFERENCE(Name, @Search) as SoundDifference From Table

DIFFERENCE returns a value from 0 to 4 where 0 is the two strings are no way close to each other and 4 they are very close of the same.
0
 

Author Closing Comment

by:rphilipson
ID: 31466395
I had tried both soundex and difference and I still can't get it to do what I want it to do.  I am going to look at something like DTsearch that might work better.  I do appreciate your help.  I am going to mess around with it some more and see if I can get it or another solution to work.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question