20 pts.
 SQL Server 2008 Code to find fields containing similar text
I want to find fields that may be the same in some parts but not 100% identical

For example

Field 1 Has the word "Smith"

Field 2 has "Smith AB" in it

Is there any code i can write to find these, without writing code for every single name I am using SQL server 2008 Thanking you in advance



Software/Hardware used:
SQL server 2008
ASKED: June 28, 2010  3:37 PM
UPDATED: July 14, 2010  8:01 PM

Answer Wiki:
You could probably use full text indexing to make this work. Otherwise you'll need to specify every column that you want to match to. No matter what technique you use, this won't be a very efficient query to run.
Last Wiki Answer Submitted:  June 28, 2010  7:31 pm  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

can’t you just do a select * from * where * like ‘%smith%’

ref: http://www.techonthenet.com/sql/like.php

or you might have to put every column name in the where clause.

 30 pts.

 

In the case when you compare with whole field, try this

where Field2 like '%'+Field1+'%' OR Field1 like '%'+Field2+'%'
 1,610 pts.