1、escape来解释转义字符

用sql语句执行模糊查询,如果要查询的包含内容和系统关键字相同,就需要使用转义字符,

如下:

我们要查询包含‘%’的所有内容,在查询的‘%’前面加上转义字符,这个‘%’就不是关键字,就是我们要查询的。

select d.completedproportion from sys_dailyfill_record d where d.completedproportion like '%\%%' escape '\'

 ESCAPE就是解释这个反斜线(\)是转义字符

 

 

2、JavaScript中用反斜线(\)来转义引号等特殊字符

var txt="We are the so-called \"Vikings\" from the north.";
document.write(txt);

如果没有(\),上面的字符串将被切成: We are the so-called,就是一对双引号之间的内容

 

 posted on 2016-09-29 09:58  布鲁布鲁sky  阅读(360)  评论(0编辑  收藏  举报