Page 1 of 1

ODBC Queries, Escaping text/reserved keywords

Posted: 20 Feb 2007, 12:09
by stevenmu
Hi all,

I have a query to list all the delivery addresses for a selected client, in short

Code: Select all

SELECT ACCOUNT_REF, DESCRIPTION, NAME, ADDRESS_1,ADDRESS_2, ADDRESS_3, ADDRESS_4, ADDRESS_5, TELEPHONE, FAX, E_MAIL
FROM            SALES_DEL_ADDR
WHERE        (ACCOUNT_REF = 'xxx')
This works fine for all clients bar one whose code is MAX, which gives me a "Syntax error: Invalid filter in where clause". This seems to be because MAX is an aggregate function/reserved keyword (and testing others seems to confirm this).

Is there any way to force the ODBC driver to see this as just another string instead of a keyword ?

(I've tried apostrophes, inverted commas etc, and using LIKE instead of = )


Cheers,
Steve.

Posted: 26 Feb 2007, 08:52
by brucedenney
Wow! this is very tough.

Have you tried lowercase?

Posted: 26 Feb 2007, 17:02
by brucedenney
Another solution is to change the name of the account, from MAX to something else.

We have a tool to do it.