

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove unconvertable characters to ASCII with SELECT in MySQL?
Let us first create a table −
mysql> create table DemoTable ( Value varchar(100) ); Query OK, 0 rows affected (0.57 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('€986'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('§97'); Query OK, 1 row affected (0.15 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+--------+ | Value | +--------+ | €986 | | §97 +--------+ 2 rows in set (0.00 sec)
Following is the query to remove unconvertable characters to ASCII −
mysql> select replace(convert(Value using ascii),'?','') from DemoTable;
This will produce the following output −
+--------------------------------------------+ | replace(convert(Value using ascii),'?','') | +--------------------------------------------+ | 986 | | 97 | +--------------------------------------------+ 2 rows in set (0.00 sec)
- Related Questions & Answers
- How to remove non-ASCII characters from strings
- How can I find non-ASCII characters in MySQL?
- MySQL query to select a specific string with special characters
- How to remove special characters from a database field in MySQL?
- How to select all the characters after the first 20 characters from a column in MySQL?
- MySQL query to remove special characters from column values?
- How to remove all non-alphanumeric characters from a string in MySQL?
- How to remove non-word characters in JavaScript?
- MySQL Query to remove all characters after last comma in string?
- Remove new line characters from rows in MySQL?
- How to use special characters in column names with MySQL?
- How to remove non-alphanumeric characters in PHP stirng?
- How to remove unique characters within strings in R?
- How to Remove Characters from a String in Arduino?
- How to select a column name with spaces in MySQL?
Advertisements