Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 1.88 KB

jaro-winkler-distance-transact-sql.md

File metadata and controls

69 lines (49 loc) · 1.88 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic dev_langs monikerRange
JARO_WINKLER_DISTANCE (Transact-SQL)
JARO_WINKLER_DISTANCE calculates the edit distance between two strings giving preference to strings that match from the beginning for a set prefix length.
MikeRayMSFT
mikeray
abhtiwar, wiassaf, randolphwest
01/21/2025
sql
t-sql
reference
TSQL
=azuresqldb-current || =fabric

JARO_WINKLER_DISTANCE (Transact-SQL)

[!INCLUDE asdb-fabricsqldb]

[!INCLUDE preview]

Calculates the edit distance between two strings giving preference to strings that match from the beginning for a set prefix length.

JARO_WINKLER_DISTANCE (
    character_expression,
    character_expression
)  

Arguments

character_expression

An alphanumeric expression of character data. character_expression can be a constant, variable, or column. The character expression cannot be of type varchar(max) or nvarchar(max).

Return value

real

Remarks

This function implements the Jaro-Winkler edit distance algorithm.

Example

The following example compares two words and returns the JARO_WINKLER_DISTANCE value as a column, named Distance.

SELECT 'Colour' AS WordUK, 
       'Color' AS WordUS, 
       JARO_WINKLER_DISTANCE('Colour', 'Color') AS Distance;

Returns:

WordUK WordUS Distance
------ ------ -------------
Colour Color  0.03333336

For additional examples, see Example JARO_WINKLER_DISTANCE.

Related content