Searching for asterisks within fields (not using as a wild card)

S

Shep

I have a field containing mainly alpha strings, some records have an asterisk
as the first character. How could I create a Select Query which just shows
me the records that begin with an asterisk? Is there a way to make an
asterisk an asterisk rather than a wild card?

Thanks,
Shep
 
A

Allen Browne

Enclose in square brackets to get JET to treat it as a literal, e.g.:

SELECT * FROM Table1 WHERE Field1 Like "[*]*";
 
F

freakazeud

Hi,
use the ASCII character representation instead.
I think the "*" is Chr(42)...so your SQL could look something like this:

SELECT tblYourTable.YourField, Left([YourField],1) AS FirstChar
FROM tblYourTable
WHERE (((Left([YourField],1))=Chr(42)));

HTH
Good luck
 
S

Shep

Thanks Allen

Allen Browne said:
Enclose in square brackets to get JET to treat it as a literal, e.g.:

SELECT * FROM Table1 WHERE Field1 Like "[*]*";

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Shep said:
I have a field containing mainly alpha strings, some records have an
asterisk
as the first character. How could I create a Select Query which just
shows
me the records that begin with an asterisk? Is there a way to make an
asterisk an asterisk rather than a wild card?

Thanks,
Shep
 
S

Shep

Thanks Oli

freakazeud said:
Hi,
use the ASCII character representation instead.
I think the "*" is Chr(42)...so your SQL could look something like this:

SELECT tblYourTable.YourField, Left([YourField],1) AS FirstChar
FROM tblYourTable
WHERE (((Left([YourField],1))=Chr(42)));

HTH
Good luck
--
Oli-S
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
http://www.oli-s.de


Shep said:
I have a field containing mainly alpha strings, some records have an asterisk
as the first character. How could I create a Select Query which just shows
me the records that begin with an asterisk? Is there a way to make an
asterisk an asterisk rather than a wild card?

Thanks,
Shep
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top