超越SOUNDEX&差异-SQL Server [英] Beyond SOUNDEX & DIFFERENCE - SQL Server

查看:116
本文介绍了超越SOUNDEX&差异-SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SOUNDEX& DIFFERENCE用于对表中存在的数据进行一些分析.

I am using SOUNDEX & DIFFERENCE functions to do some analysis on the data present in the table.

但是此功能在以下数据类型下失败. ITEM TYPE& ITEM SIZE完全不同.

But this function fails at below type of data. The ITEM TYPE & ITEM SIZE are completely different.

SELECT SOUNDEX('ITEM TYPE'), SOUNDEX('ITEM SIZE')

op:-

I350    I350

For DIFFERENCE op: - 4

我了解无法编码人脑的每项分析,但我仍然想问一下,SQL Server中是否还有其他功能可以帮助我进行下一级分析?

I understand every analysis that human mind do can not be coded, still I would like to ask, are there exists any other functions in SQL Server that will help me out on my next level analysis ?

推荐答案

您可以使用算法,例如 Damerau–Levenshtein距离.

You can use an algorithm, such as Damerau–Levenshtein distance.

两个单词之间的Damerau–Levenshtein距离最小 操作次数(包括插入,删除或 单个字符的替换,或两个相邻字符的换位 字符)将一个单词转换为另一个单词.

The Damerau–Levenshtein distance between two words is the minimum number of operations (consisting of insertions, deletions or substitutions of a single character, or transposition of two adjacent characters) required to change one word into the other.

有T-SQL实现,例如这是Steve编写的Hatchett . 或者,您可以使用 C#中的实现,编译一个DLL并将其加载到SQL CLR中.编译版本应该更快.

There are T-SQL implementations, such as this one by Steve Hatchett. Alternatively, you can use an implementation in C#, compile a DLL and load it into SQL CLR. Compiled version should be faster.

有关将CLR程序集加载到SQL中的更多信息@ SQL Server中的CLR程序集C#.

More info on loading CLR assemblies into SQL @ CLR Assembly C# inside SQL Server.

这篇关于超越SOUNDEX&差异-SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆