Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MS Access: searching a column for a star/asterisk

I'm looking for a way to search a column of string datatype which contains a * - the problem is that the star or asterisk is a reserved symbol. The following query doesn't work properly:

select * from users where instr(pattern,"*")

How can you write an Access query to search a column for an asterisk?

like image 764
Fuxi Avatar asked Nov 17 '25 20:11

Fuxi


2 Answers

You can search for reseverd charaters in Access by using square brackets:

select * from users where pattern like "*[*]*"
like image 134
Fionnuala Avatar answered Nov 20 '25 11:11

Fionnuala


yay, found it out by myself:

select * from users where instr(pattern,chr(42))
like image 36
Fuxi Avatar answered Nov 20 '25 11:11

Fuxi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!