Removing/replacing special character from database.

11 / Jun / 2012 by Anuj Aneja 0 comments

Recently in one of my project i faced a problem that database was having special character, which is shown as space on the User Interface.

So as to solve this issue i found a very simple solution which consists of following steps:

1. First, you just need to identify which type special character to be removed/replaced like in my case it was shown as space but stored as <?> in the db.

For that you can use the query.

[sql]select HEX(email) from person;[/sql]

and you can also refer to this link for ASCII code of character. In my case it was 160.

2.  Now, next step is simple just run this query.

[sql] update person set email=replace(email,char(160),”); [/sql]

Thats it !!!  🙂

It helps me a lot!!! Hope that helps you guys!!!

Anuj Aneja

Intelligrape Software Pvt. Ltd.

FOUND THIS USEFUL? SHARE IT

Tag -

Database MySql

Leave a Reply

Your email address will not be published. Required fields are marked *