SQL Flow Field Guide

EDIT_DISTANCE

Catalog support for SQL Server 2025 (17.x)

approximate string comparison

What changes

Input
two strings
Output or change
distance or similarity score
Return type
int This function implements the Damerau-Levenshtein (Optimal String Alignment) algorithm to return the distance between the two character_expressions, or maximum_distance value if that is smaller. If

Syntax at a glance

EDIT_DISTANCE ( character_expression , character_expression [ , maximum_distance ] )

Work example

Measure likely spelling differences when reviewing possible duplicate labels.

Normalize a comparison copy and send close matches to human review instead of merging records automatically.

Check your work Fuzzy matching requires the SQL Server 2025 preview feature setting and a low distance is not proof of identity.

Open Microsoft Learn for full syntax, permissions, and details for your version.