Click here to Skip to main content
16,018,418 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why did the following statement in SQL SERVER 2008
RETURN 1 AS OUTPUT

SELECT DIFFERENCE('Hello','World')


I read the Wikipedia for the answer I got it but I didn't understand...
Posted

SOUNDEX CODE ALGORITHM IS EXPLAINED HERE


http://www.gedpage.com/soundex.html[^]
 
Share this answer
 
Difference always returns a value from 0 to 4.

In this case it compares "Hello" with "World".
So how much does these two words look alike.

meaning
0 : Totally different
1 : different
2 : somewhat the same
3 : looks the same
4 : the same or a strong similarity.

So the 1 you got means that the words are not the same.
Why a 1 and not a 0?
Probably because the length of the words are similar.
 
Share this answer
 
The documentation is pretty clear : DIFFERENCE (Transact-SQL)[^]
 
Share this answer
 
Comments
Maciej Los 18-Dec-14 5:10am    
+5
Mehdi Gholam 18-Dec-14 5:17am    
Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900