Waqar
Waqar

Reputation: 758

Fuzzy matching SQL Syntax

How in SQL can we write something which performs matching similar to the SSIS Fuzzy Matching component ?

What options do we have available using SQL Server features and SQL syntax ?

Thanks,

Upvotes: 2

Views: 1585

Answers (2)

Louie Bao
Louie Bao

Reputation: 1732

The easiest way to do fuzzy matching in T-SQL would be using SOUNDEX() and DIFFERENCE().

For example

select 
soundex('SQL') as 'four-character (SOUNDEX) code' -- Returns S240
, soundex('Sequel') as 'four-character (SOUNDEX) code' -- Returns S240
, difference('SQL', 'Sequel') as  '0: weak or no similarity. 4: strong similarity or the same values.' -- Returns 4

Upvotes: 1

podiluska
podiluska

Reputation: 51494

You can use the full text indexing feature of SQL server, together with the associated functions CONTAINS, RANK, etc.

Upvotes: 1

Related Questions