Giacomo Brunetta
Giacomo Brunetta

Reputation: 1577

SQL Wildcard in Access: "%" and "_" don't works

I tryed some wildcards in Access in Where statement, but they don't works. For example:
This query SELECT staff.* FROM staff;returns:

enter image description here

I tryed to do a query with wildcard SELECT staff.* FROM staff WHERE (staff.s_name LIKE "A%"); but it returns an empty table:

enter image description here

What is the reason? My wildcard doesn't work

(s_name is the second column)

enter image description here

(look that "firstname" is the tag of "s_name" only for the view)

Upvotes: 0

Views: 3415

Answers (2)

ASH
ASH

Reputation: 20362

No, no, no, use '*', not '%'. Or, use 'Like'.

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

For instance:

Like 'm*' Result: all values that start with m

Like 'm' Result: all values that contain m

Like '*m' Result: all values that end with m

enter image description here

enter image description here

Upvotes: -1

Andrey Korneyev
Andrey Korneyev

Reputation: 26896

Wildcard character in Access is *, not % unlike in SQL Server.

See MSDN for details.

Upvotes: 4

Related Questions