Click to See Complete Forum and Search --> : SQL


softweng
August 8th, 2001, 01:37 PM
I am trying to execute a select statement in Access 2000. I need to know how to use
wildcard's in the statement. I thought you used the * for a wildcard in the LIKE clause but apparently not.
My SQL statement looks like this:
SELECT * FROM [Table] WHERE [Table].[Field] LIKE *
The problem is in the LIKE part of the statement. I need to know how use LIKE to find anything (wildcard) in the particular field.
Thanks for any help!!!

Kris
Software Engineer
Phoenix,AZ

Iouri
August 8th, 2001, 01:58 PM
Try to use % instead of *
and _ instead of ?


SELECT * FROM [Table] WHERE [Table].[Field] LIKE 'ABC%'

This SQL will give you everything starting with ABC

Iouri Boutchkine
iouri@hotsheet.com

Andrew_Fryer
August 9th, 2001, 02:06 AM
Hello,

enclose the asterisk in single quotes, i.e

SELECT * FROM [Table] WHERE [TABLE].[FIELD] LIKE '*'

alternatively the code you have provided seems to return all the values when it works so why not use

SELECT * FROM [TABLE]

Hope this helps

Andrew