SQL Server/T-SQL/String Functions/SOUNDEX
SOUNDEX: check how similarly sounding two tested strings can be
1> -- SOUNDEX: check how similarly sounding two tested strings can be.
2>
3> SELECT SOUNDEX("Robin Dewson"), SOUNDEX("Robyn Jewshoon")
4> GO
----- -----
R150 R150
(1 rows affected)
1>
SOUNDEX(): make quantitative comparisons
1>
2> -- SOUNDEX(): make quantitative comparisons.
3>
4> DECLARE @Word1 VarChar(100)
5> DECLARE @Word2 VarChar(100)
6> DECLARE @Value1 Int
7> DECLARE @Value2 Int
8> DECLARE @SoundexDiff Int
9>
10> SET @Word1 = "Joe"
11> SET @Word2 = "Joose"
12> SELECT @Value1 = CONVERT(Int, SUBSTRING(SOUNDEX(@Word1), 2, 3))
13> SELECT @Value2 = CONVERT(Int, SUBSTRING(SOUNDEX(@Word2), 2, 3))
14> SET @SoundexDiff = ABS(@Value1 - @Value2)
15>
16> PRINT @SoundexDiff
17> GO
200
1>