Returns the difference between two soundex values.
difference(expr1,expr2)
is a character-type column name, variable, or constant expression of char, varchar, nchar, nvarchar, or unichar type.
is another character-type column name, variable, or constant expression of char, varchar, nchar, nvarchar, or unichar type.
select difference("smithers", "smothers")
--------- 4
select difference("smothers", "brothers")
--------- 2
difference, a string function, returns an integer representing the difference between two soundex values.
The difference function compares two strings and evaluates the similarity between them, returning a value from 0 to 4. The best match is 4.
The string values must be composed of a contiguous sequence of valid single- or double-byte roman letters.
If expr1 or expr2 is NULL, returns NULL.
If you give a varchar expression is given as one parameter and a unichar expression as the other, the varchar expression is implicitly converted to unichar (with possible truncation).
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute difference.
Documentation Transact-SQL Users Guide
Function soundex