SQLTeam.com | Weblogs | Forums

Fuzziness with wildcards

Hello

Is it possible to use soundex or other algo to match e.g.:
ABC Inc
with
xxxx xxxxx ABC Corp xxxx xxxx
(where x is any character)

In other words, fuzzy match usually compares the whole strings as one but I would like to also match if the reference string has a fuzzy match somewhere inside the to be checked string.

Thanks!

SQL Server has a SOUNDEX() function you can use.

Yes but it does not work in the way I want to, i.e. check if a string exists as a substring in another list?

one thing is LIKE operator

RegEx may help you

Thanks but was looking for SOUNDEX of a reference string vs another field that may have the SOUNDEX as substring

declare @fuzzy_bear table(gumbo nvarchar(max))

insert into @fuzzy_bear
select 'xxxx xxxxx ABC Corp xxxx xxxx'

declare @inc nvarchar(10) = 'ABC Inc'


select *, DIFFERENCE(c.item, @inc) , SOUNDEX(c.item), soundex(@inc)

 from @fuzzy_bear a
 cross apply alba.dbo.DelimitedSplit8K(a.gumbo,' ')c 

select *, DIFFERENCE(c.item, @inc) , SOUNDEX(c.item), soundex(@inc)

 from @fuzzy_bear a
 cross apply alba.dbo.DelimitedSplit8K(a.gumbo,' ')c 
 where SOUNDEX(c.item) = soundex(@inc)

image

DelimitedSplit8K by @JeffModen

1 Like