?
Solved

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

Posted on 2008-06-11
4
Medium Priority
?
260 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 375 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

770 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