Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server similar function like with postgres

Does SQL Server have an equivalent function to Postgres Similar to compare strings?

I looking for something that will match

str1 = "Flat 1, 110 Bob Street" 
str2 = "110, Bob St. Flat 1" 

so I can do

select
...
from
t1 join 
t2  on (similar(t1.str1,t2.str2) >= 0.9)
like image 880
jlondal Avatar asked Feb 13 '26 21:02

jlondal


1 Answers

Here are some implementations of string distance functions in TSQL that might help:

Levenshtein

Jaro-Winkler (Registration required)

SoundEx

MatchText

I have had a lot of luck with Jaro-Winkler, but of course that's due to the nature of my data. The one that closest resembles the similarity query that you asked about is MatchText.

like image 95
Kirk Roybal Avatar answered Feb 16 '26 14:02

Kirk Roybal