Similarity
Computes a similarity value of two strings in SQL Server
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.HashString ( @Algorithm, @String1, @String2 )
Name | Type | Description |
---|---|---|
@Algorithm | varchar(5) | One of the following Algorithm: JW and DL (for Jaro-Winkler and Damerau-Levenshtein, respectively) |
@String1 | nvarchar(MAX) | First string for which to compute similarity. These value are case sensitive even in case-insensitive SQL Server instances |
@String2 | nvarchar(MAX) | Second string for which to compute similarity. These value are case sensitive even in case-insensitive SQL Server instances |
numeric(27,7)
Jaro-Winkler:
1 2 3 |
SELECT SQLHTTP.net.Similarity('JW', UPPER('kitten'), UPPER('sitting')) |
1 2 3 4 |
-------------- 0.7460317 |
Damerau-Levenshtein:
1 2 3 |
SELECT SQLHTTP.net.Similarity('DL', UPPER('kitten'), UPPER('sitting')) |
1 2 3 4 |
-------------- 3.0000000 |