From: גנן גידל דגן on
Following examples i found on the web i tried to build my own SQL condition
for a query to search all columns in table "a" for the text containing the
word milk.
Here is what i came up with:

SELECT *
FROM [a]
WHERE CONTAINS(*, milk)

I am getting error message: "Syntax error (missing operator) in Query
Expression 'CONTAINS(*,milk)'

what is the missing operator?

i tried replacing "*" with a specific column name but i am still getting the
same error.

From: Douglas J. Steele on
There is no CONTAINS operator in SQL.

The correct syntax would be

SELECT *
FROM [a]
WHERE [fieldname] = "milk"

or

SELECT *
FROM [a]
WHERE [fieldname] LIKE "*milk*"



--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"??? ???? ???" <@discussions.microsoft.com> wrote in message
news:7532BCA9-D71C-48B0-93D2-E1EB5F9FD1A7(a)microsoft.com...
> Following examples i found on the web i tried to build my own SQL
> condition
> for a query to search all columns in table "a" for the text containing the
> word milk.
> Here is what i came up with:
>
> SELECT *
> FROM [a]
> WHERE CONTAINS(*, milk)
>
> I am getting error message: "Syntax error (missing operator) in Query
> Expression 'CONTAINS(*,milk)'
>
> what is the missing operator?
>
> i tried replacing "*" with a specific column name but i am still getting
> the
> same error.
>


From: Jeff Boyce on
SQL comes in "dialects" ... Where are you trying to use this?

If you are working completely within Access (front-end and back-end),
perhaps the phrase you're looking for is IN('a','b', ...) instead of
CONTAINS().

.... and if you have a well-normalized table structure, you probably wouldn't
need to be checking "all columns in a table for" a text string.

Take a look at Access HELP for the proper syntax using wildcard characters
in Access.

Good Luck!

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"??? ???? ???" <@discussions.microsoft.com> wrote in message
news:7532BCA9-D71C-48B0-93D2-E1EB5F9FD1A7(a)microsoft.com...
> Following examples i found on the web i tried to build my own SQL
> condition
> for a query to search all columns in table "a" for the text containing the
> word milk.
> Here is what i came up with:
>
> SELECT *
> FROM [a]
> WHERE CONTAINS(*, milk)
>
> I am getting error message: "Syntax error (missing operator) in Query
> Expression 'CONTAINS(*,milk)'
>
> what is the missing operator?
>
> i tried replacing "*" with a specific column name but i am still getting
> the
> same error.
>


 | 
Pages: 1
Prev: Antivirus Free Download
Next: jeramie bellmay