Exchange accented characters for accented characters

Asked

Viewed 602 times

1

There’s some kind of method of me making a replace in characters based on CASE? I’m looking for something like this:

UPDATE foo SET bar = SUBSTRING(bar, "Ã","ã");
-- se o caracter for LOWER -> ã
-- se o caracter for UPPER -> Ã

Imagine the table below:

-------------------------
| id | nome             |
-------------------------
|  1 | Cão              |
|  2 | ALEMÃO           |
|  3 | jOÃO             |
-------------------------

I need you to turn into this

-------------------------
| id | nome             |
-------------------------
|  1 | Cao              | -> trocou "ã" por "a"
|  2 | ALEMAO           | -> trocou "Ã" por "A"
|  3 | jOAO             | -> trocou "Ã" por "A"
-------------------------
  • 1

    You will need to create a Function for this, see if tutorial here helps you: http://www.devmedia.com.br/funcao-para-remover-acento/17293

1 answer

2


You can use the COLLATE to accomplish this, I do not know if it is what you want or if it will work, the question is too generic:

UPDATE foo SET bar = (SELECT bar COLLATE SQL_Latin1_General_Cp1251_CS_AS);

I put in the Github for future reference.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.