How to remove these "special characters" from MySQL results?

Issue

In the database I’m using, some of the pieces are formatted like this

S    1    A    1    

Is there any function to remove the characters and format my result as just

S1A1 

to clean this up? Notepad++ shows the characters are SOH (Start of Header). Thanks!!

Solution

SOH is ASCII code 1, so you can use

REPLACE(columnname, CHAR(1), '')

to remove them from the value.

Answered By – Barmar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published