mysql替换斜杠,mysql:替换字符串中的(反斜杠)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 yourlf like this:
create table T ( Name varchar(10));
inrt into T values ('A\\\\B\\C');
教研组长lect * from T;
仰漂
Now if I do this:
lect Name from T where Name = 'A\\B\C';
mid函数的使用方法
That doesn't work, I need to escape the \ (backslash):
lect 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:
lect replace('A\\B\C', '\\', '\\\\');
I get: A\\\BC
Any suggestions?
Many thanks in advance.
解决⽅案
You have to u "verbatim string".After using that string your Replace function will
look like this
Replace(@"\", @"\\")
I hope it will help for you.