Solved

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

Posted on 2008-06-11
4
251 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
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:NIMTUG_Simon
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now