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>
Related examples in the same category