SQL Server 2008 Code to find fields containing similar text

20 pts.
Tags:
SQL
SQL commands
SQL Server 2008 administration
SQL Server development
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Davewaltonuk
    [...] Davewaltonuk was looking for SQL Server 2008 Code to find fields containing similar text. Have anything to add to Mr. Denny’s [...]
    0 pointsBadges:
    report
  • Davewaltonuk
    [...] Davewaltonuk was looking for SQL Server 2008 code to find fields containing similar text, and Mr. Denny gave it his best [...]
    0 pointsBadges:
    report
  • Frankchristopher
    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 pointsBadges:
    report
  • msi77
    In the case when you compare with whole field, try this
    where Field2 like '%'+Field1+'%' OR Field1 like '%'+Field2+'%'
    1,670 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following