• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1206
  • Last Modified:

SQL Query to Replace Symbols


I need to write an SQL query for MySQL to go through my database and replace symbols. I have a form people can copy and paste from Microsoft Word from. It brings all sorts of bizarre encoding problems with it.

I am seeing the following in place of an apostrophe: ―

My SQL query can find and replace the "â€" portion just fine. When I ask it to find that round bullet point, however, it can't. Despite the fact that I copied and pasted the bullet point directly from an SQL entry, it can't find it. Is there any way to include it in a query to get MySQL to find it?

  • 2
1 Solution
NorieVBA ExpertCommented:

How are you doing the find/replace that's works?
jkeagle13Author Commented:
Using the following: update TABLE set FIELD = replace(FIELD,'–','-')
NorieVBA ExpertCommented:
If you can find out the ASCII code for the symbol(s) you want to get rid of you can use CHAR in the Replace.

I think the code for the bullet point could be 226, that's what I get when I check in MySQL anyway.

If that doesn't work you can always copy that single character and paste it in the query.

There's also a whole bunch of other string functions you could probably use.

REPLACE(test1.txtfield, SUBSTRING(test1.txtfield, LOCATE( 'â€', test1.txtfield),3),'-')
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now