2017-03-09 73 views
0

我在Where语句的Access中尝试了一些通配符,但它们不起作用。例如:
此查询SELECT staff.* FROM staff;回报:访问中的SQL通配符:“%”和“_”不起作用

enter image description here

我tryed做通配符SELECT staff.* FROM staff WHERE (staff.s_name LIKE "A%"); 查询,但它返回一个空表:

enter image description here

的原因是什么?我的通配符不起作用

(S_NAME是第二列)

enter image description here

(看说: “姓” 是 “S_NAME” 的标签只可用于视图)

+0

我不能看到名称'人员任一列结束的所有值。 s_name'。我只看到'firstname'和'surname' – Jens

+0

抱歉,s_name是firstname,我只更改了标签 –

回答

4

通配符在Access中是*,而不是在SQL Server中不是%。详细请参照MSDN

+0

除非您使用ALIKE或者您选择了SQL 92,这可能不是一个好主意。 – Fionnuala

+0

哦,谢谢!什么是ALIKE? –

+1

它与LIKE几乎相同,除了可以使用%作为通配符。 – Fionnuala

-1

不,不,使用'*',而不是'%'。或者,使用“赞”。

http://www.techrepublic.com/article/10-tips-for-using-wildcard-characters-in-microsoft-access-criteria-expressions/

https://www.techonthenet.com/access/queries/like.php

https://www.techonthenet.com/access/queries/like2007.php

例如:

像 'M *' 结果:以m开始的所有值

像 '' 结果:包含所有m值

像 '×M' 结果:以m

enter image description here

enter image description here

+0

“Like'm'结果:包含m的所有值”不,它不。 – Fionnuala