I
I
Ivan Melnikov2018-04-06 17:11:40
MySQL
Ivan Melnikov, 2018-04-06 17:11:40

How to get rid of backslash in VARCHAR with INSERT?

With , an error occurs because the backslash escapes the single quote. Question. How to get rid of this backslash and make a recording as if this backslash did not exist at all? The REPLACE() function does not help... I tried REPLACE('ivan\', '\', '') and REPLACE('ivan\', '\\', ''). Or how, for example, to replace all backslashes in the text (to avoid escaping) with forward slashes? ps. The application writes to the database not directly, but through my stored function. When calling the function with the 'ivan\' parameter, an error occurs (syntax). Without the backslash at the end, everything is written perfectly. I don't have access to the app. The problem needs to be solved EXCLUSIVELY by means of MySQL. pps
insert into table_name(name) value('ivan\');


Alternatively, you can read the string in binary form and if you see a backslash byte, then change it to a slash byte or any other string. But that's just some bullshit. Surely there is a way to solve it much easier and more natural.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanovskiy, 2018-04-06
@Sanovskiy

insert into table_name(name) value('ivan\\');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question