[Zope] newbie - odbc missing operator

Ross J. Reedstrom reedstrm@wallace.ece.rice.edu
Mon, 16 Aug 1999 12:46:31 -0500


On Mon, Aug 16, 1999 at 11:24:22AM -0500, Michael Guidry wrote:
Micheal - 
I'm not familiar with the dbase flavor of ODBC, nor what Crystal Report uses,
but my guess is that it'll map standard SQL syntax to whatever the
backend wants. In that case, you need to know that 'startswith' is not
an SQL standard operator. The standard way to express what you want is:

select name, phone
from contact1
where phone LIKE '(918)%'

The LIKE operator takes two kinds of wild cards: 
single character: _ (yup, underscore) and zero or more characters: %. You 
can think of them acting like ? and * at the DOS prompt.

BTW, as you can tell, this is an SQL question, not a Zope specific one.

Ross

> Using dbase, I want to find all records which have a phone that begins with a specific area code. I try
> select name, phone
> from contact1
> where phone startswith '(918)'
> (The same query works with crystal report.)
> which produces...
> Error, sql.error: ('37000', -3100, "[Microsoft][ODBC dBase Driver] Syntax error (missing operator) in query expression 'phone1 startswith '(918)''.")
> 
> I can use = as an operand but need to know how to use other odbc operands. 
> Also, anyone know where a list of operands for dbase might be located on the internet.
> Michael Guidry
> michael.guidry@trigenttechnologies.com


-- 
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> 
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005