mysql-function-to-remove-special-characters-accents

Here is a MySQL function using which you can clean your data in database table. Its usage is quiet easy and it allows few options like retrieve only alphabets, numbers allow/disallow spaces etc.

Also, it can remove accents in data and trims the data by removing extra spaces, tabs, newline characters which sometimes are hidden in data and are difficult to remove using simple TRIM() function.
Usage Syntax:

where,

string: is the string to clean.
allow_space: Flag to remove spaces(in between string) from result. Default is 0, pass 1 as parameter to on the flag

allow_number: Flag to remove numbers from result. Default is 0, pass 0 as parameter to off the flag

allow_alphabets: Flag to remove alphabets from result. Default is 1, pass 0 as parameter to off the flag

no_trim: Flag for not to trim (remove extra spaces, tabs,newline characters) result. Default is 1, pass 0 as parameter to off the flag

Examples:

So Here is the MySQL function to Remove Special Characters, Accents, Non-ASCII characters:

Download as SQL file:

Download