SQL Server compares two word similarity Functions

Source: Internet
Author: User

The soundex function converts a string to a four-digit number.CodeTo be used in comparison. The vowels are ignored during comparison. Non-letter characters are used to end the comparison. This function always returns a value.

The following example showsSoundexFunctions for similar stringsSmithAndSmythe. When two strings are similar, their soundex code is the same.

 
Select soundex ('Smith '), soundex ('smy'); go

The following is the result set:

 
----- S530 s530 (1 row (s) affected)

The difference function compares the soundex values of two strings and evaluates their similarity,Returns a value between 0 and 4.4 indicates the highest matching. The first one in the following exampleSelectReturnedDifferenceIs4Because Smithers and smothers have only one character.

 
Select difference ('smithers', 'smothers '); go

The following is the result set:

 

------------ 4 (1 row (s) affected)

The following example returnsDifferenceIs3. This indicates that although two strings have several different characters, they have similar pronunciations.

 
Select difference ('jeff ', 'geoffe'); go

The following is the result set:

 

 
----------- 3 (1 row (s) affected)
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.