Use SOUNDEX() word by word on SQL Server

前端 未结 5 1617
青春惊慌失措
青春惊慌失措 2020-12-31 23:59

Here is my problem. For example I have a table Products that contains a field, Name:

Products
ID | Name | ..
1  | \"USB Key 10Go\"
2  | \"I         


        
5条回答
  •  北海茫月
    2021-01-01 00:32

    Rather than use Soundex you might be better off computing the Levenshtein distance between the two strings. See the Wikipedia article on Levenshtein distance.

    There's a TSQL implementation of the Levenshtein distance algorithm here.

    Share and enjoy.


    EDIT 03-May-2012

    Since writing my original response I've learned that Oracle includes the Levenshtein distance and several other "string similarity" functions in the UTL_MATCH package, which I believe is a standard part of the database. Documentation here. Perhaps not directly related to the original post (which was for SQL Server) but perhaps useful as many shops use multiple databases.

提交回复
热议问题