mysqlsqlsql-serversoundex

SQL Server soundex and MySQL soundex difference


Hello I want to use Soundex on SQL Server. I found good example for MySQL:

SELECT SOUNDEX('game of thrones')

When I tried this query:

I searched but couldn't find why. Aren't they same?


Solution

  • From the MySQL documentation:

    A standard soundex string is four characters long, but the SOUNDEX() function returns an arbitrarily long string. You can use SUBSTRING() on the result to get a standard soundex string.

    The version that MSSQL returns is the normal length, MySQL is just being different for some reason.

    Also looks like MSSQL is only looking at the first word. With a third soundex implementation, SOUNDEX('game') gives G500 and SOUNDEX('game of thrones') gives G513.