简体   繁体   English

SQL Where..Like子句,用于包含空格和特殊字符(如@,!,#)的搜索条件

[英]SQL Where..Like clause for search criteria containing a Space and special characters like @, !, #

Good day all, 大家好

I am trying a basic select query with Search Criteria as shown below on an Access Database table. 我正在尝试使用搜索条件进行基本的选择查询,如下所示在Access数据库表上。 Its not returning any values from the database table. 它不从数据库表返回任何值。

The search criteria which is the value from table contains a Space followed by @ , and then other special characters like ! 搜索条件是表中的值,其中包含一个空格,后跟@ ,然后是其他特殊字符,如! , # . #

Since I want to return all values matching this criteria, I am using % in the end. 由于我想返回所有与此条件匹配的值,因此最后使用% For testing purposes, if I specify the complete value as criteria then it works but would appreciate if someone can suggest a correct syntax for below query. 出于测试目的,如果我将完整值指定为条件,则可以使用该值,但是如果有人可以为以下查询建议正确的语法,将不胜感激。

once sorted, I need to use in Vb .Net application. 一旦排序,我需要在Vb .Net应用程序中使用。 Thanks in advance. 提前致谢。

SELECT linkage.Value, linkage.file
FROM linkage
WHERE (((linkage.Value) Like " @a=0027!!20003##%"));
SELECT linkage.Value, linkage.file
FROM linkage
WHERE (((linkage.Value) Like "% @a=0027!!20003##%"));

just put it between two % % 只需将其放在两个% %之间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM