Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
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)
Advertisements
