我在表中有类似'abc 100%文本‘的记录。
我想搜索所有包含100%的记录。
什么是LIKE查询?
SELECT * FROM TABLE where ColName LIKE '100%%'上面的查询返回错误的结果。
谢谢。
发布于 2011-08-02 18:39:48
SELECT * FROM TABLE where ColName LIKE '%100[%]%'看一看Using Wildcard Characters As Literals
您可以使用通配符模式匹配字符作为原义字符。若要将通配符用作文字字符,请将通配符包括在方括号中。
发布于 2011-08-02 18:41:37
SELECT columns FROM table WHERE column LIKE '%[%]%'或
SELECT columns FROM table WHERE column LIKE '%\%%' ESCAPE '\'如http://web.archive.org/web/20150519072547/http://sqlserver2000.databases.aspfaq.com:80/how-do-i-search-for-special-characters-e-g-in-sql-server.html中所述
发布于 2011-08-02 18:42:17
此外,您还可以使用转义字符...
LIKE '%100^%%' ESCAPE '^'http://web.archive.org/web/20150519072547/http://sqlserver2000.databases.aspfaq.com:80/how-do-i-search-for-special-characters-e-g-in-sql-server.html
https://stackoverflow.com/questions/6910727
复制相似问题