mysql: replace \ (backslash) in strings
backslash, mysql, replace
Solution
You have to use "verbatim string".After using that string your Replace function will look like this
Replace(@"\", @"\\")
I hope it will help for you.
Problem
I am having the following problem: I have a table T which has a column Name with names. The names have the following structure: A\\B\C You can create on yourself like this: ``` create table T ( Name varchar(10)); insert into T values ('A\\\\B\\C'); select * from T; ``` Now if I do this: ``` select Name from T where Name = 'A\\B\C'; ``` That doesn't work, I need to escape the \ (backslash): ``` select Name from T where Name = 'A\\\\B\\C'; ``` Fine. But how do I do this automatically to a string Name? Something like the following won't do it: ``` select replace('A\\B\C', '\\', '\\\\'); ``` I get: `A\\\BC` Any suggestions? Many thanks in advance.