Wednesday 26 December 2018

SOUNDEX Function in SQL Server

SOUNDEX converts an alphanumeric string to a four-character code that is based on how the string sounds when spoken. The first character of the code is the first character of character_expression, converted to upper case. The second through fourth characters of the code are numbers that represent the letters in the expression.
Syntax
SOUNDEX(String)

See example
  

  
SOUNDEX ignores the vowels (‘A’,’E’,’I’,’O’,’U’) from alphanumeric strings until that is not the first character of the string. If the alphanumeric string is small and necessary to generate a four-character code then extra zeroes are added at the end of the string.
See below example
  
In you o and u both are ignored.
Number
Represent the Letters
1
B,F,P,V
2
C, G, J, K, Q, S, X, Z
3
D, T
4
L
5
M,N
6
R
A, E, I, O, U, H, W, and Y letters are ignored from the alphanumeric string.

After seeing the output result we are not able to understand, a question arises -- what is the use of Soundex or where can we implement it in our project. Generally, SOUNDEX is used in a search engine. SOUNDEX is used in FULL-Text search where we want to search similar words.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts