UPDATE Adressen SET `Straße`=REPLACE(`Straße`,'\','');" - How to escape \ in mysql?

Viewed 35

I am using the https://www.mysqltutorial.org/mysql-string-replace-function.aspx but i can't replace: \

I am using DBeaver on MacOS.

Its working with other letters:

UPDATE products 
SET 
    productDescription = REPLACE(productDescription,
        'abuot',
        'about');

But this is not working:

UPDATE products 
SET 
    productDescription = REPLACE(productDescription,
        '\',
        '');
1 Answers

You have to escape the backslash (\) using double backslash (\\):

UPDATE products SET productDescription = REPLACE(productDescription, '\\', '');

demo on dbfiddle.uk

You can find a list with all special characters on the MySQL documentation (Table 9.1 Special Character Escape Sequences).

Related