SQL Flow Field Guide

DIFFERENCE

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

string transform

What changes

Input
string arguments
Output or change
string or integer
Return type
int

Syntax at a glance

DIFFERENCE ( character_expression , character_expression )

Work example

Compare two SOUNDEX results for a coarse phonetic similarity score.

Test Unicode, trailing spaces, collation, empty input, and maximum output length.

Check your work Treat the score as a review signal because distinct words can share it.

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