Search This Blog

Wednesday, August 22, 2012

Difference() function in SQL Server


Difference() is a built in function in SQL server.
This function will compare two character values according to their sounds and return the values from 0 - 4 as a result.

Results 0 - 4 Represents the below;

4:  indicates strong similarity
3:  indicates relative match
2:  indicates fair match
1:  indicates weak
0:  indicates no similarity


SELECT val1,val2 , DIFFERENCE (val1, val2) AS [DIFFERENCE]
FROM table



RESULT:
--------------------------------------------------
val1               val2           DIFFERENCE
--------------------------------------------------
askdotnet       askdotnet          4
askdotnet       aspdotnet          3
askdotnet       askjave             2
askdotnet        jave                 1
askdotnet        php                  0

No comments :