Edit

Share via


JARO_WINKLER_DISTANCE (Transact-SQL) preview

Applies to: SQL Server 2025 (17.x) Preview Azure SQL Database Azure SQL Managed Instance SQL database in Microsoft Fabric

Note

As a preview feature, the technology presented in this article is subject to Supplemental Terms of Use for Microsoft Azure Previews.

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

Note

  • JARO_WINKLER_DISTANCE is currently in preview.
  • SQL Server support for JARO_WINKLER_DISTANCE introduced in SQL Server 2025 (17.x) Preview.

Syntax

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.