Mega Code Archive

 
Categories / MSSQL Tutorial / String Functions
 

DIFFERENCE function returns a value between 0 and 4 that reflects how close a match there is between the two strings

A value of 0 means that the two strings aren't even close. A value of 4 means a perfect match. 8> DECLARE @STRING_DIFFERENCE1 varchar(6) 9> DECLARE @STRING_DIFFERENCE2 varchar(6) 10> SET @STRING_DIFFERENCE1 = "Dewson" 11> SET @STRING_DIFFERENCE2 = "Joosun" 12> SELECT DIFFERENCE(@STRING_DIFFERENCE1,@STRING_DIFFERENCE2) 13> GO -----------           2 (1 rows affected)