Re: Foxpro sql limitations

From: Rush Strong (rush.strong)
Date: 07/13/04


Date: Tue, 13 Jul 2004 16:44:21 -0700


"Steve G" <steve@tracorp.com> wrote in message
news:5b42aaf3.0407131356.e1d9b6f@posting.google.com...
> Hello,
>
> I am developing an ASP application that has to interface with a Foxpro
> database for some things, in addition to a SQL Server database. I am
> connecting through ODBC and using Jscript as my language of choice.
>
> I have programmed thus far with the knowledge of a few of Foxpro's
> 'quirks' that make it so fun to program with. My favorite is the one
> where you can't have more than 20 items in an IN clause. After all,
> who would possibly need a clause with more than 20 items? Would such
> a gargantuan beast even have a use? </sarcasm> As a programmer, I
> see no logical reason why this limitation is the programmer's
> responsibility to deal with as opposed to the DBMS query engine. But
> I take this in stride with the knowledge that it wasn't my choice to
> use Foxpro.
>
> But now I have a new one that I've run into, and I get the nauseating
> feeling that the worst solution is the only one. I am now executing
> statements where it comes back and says they are too long:
>
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC Visual FoxPro Driver]SQL: Statement too long.
>
> This is occuring on a statement in which the example has 178 4-digit
> numbers in the IN clause (broken up into 8 nice groups of 20 each,
> plus another 18). The entire statement looks remarkably similar to
> this:
>
> SELECT vehicle_id FROM yes02v WHERE ml_id IN (1381, 2166, 2290, 2292,
<snip>
> 6953, 6954, 7005, 7006, 7007, 7008, 7022, 7026, 7083, 7108, 7109,
> 7122, 7153, 7157) ORDER BY fleet_num

I'm not an ODBC pro, but if I was doing this in native Fox I'd put all those
ml_id values in a cursor (one field - ml_id), then use:

    SELECT vehicle_id, fleet_num ;
        FROM yes02v, MyCursor ;
        WHERE yes02v.ml_id = MyCursor.ml_id ;
        ORDER BY fleet_num

 - Rush



Relevant Pages

  • Re: Need to open Visual Fox Pro 8 tables in VB6
    ... There are several formats of Visual FoxPro files. ... VFP6 and below are readable via ODBC. ... "database container". ... Data Sources. ...
    (microsoft.public.vb.database.dao)
  • Re: VFP 8 and ODBC connection
    ... Instead of the overhead of ODBC or OLEDB, ... If the tables are part of a database, ... Microsoft Visual FoxPro MVP ... dedicated application server and the database part of the software on ...
    (microsoft.public.fox.helpwanted)
  • switching from odbc to oledb
    ... foxpro v6 database. ... Now the odbc drivers don't work anymore. ... need to use the ole db provider to connect to the v9 foxpro database. ...
    (microsoft.public.data.oledb)
  • Pass multiple values between tables
    ... I have an ODBC in Access of 18 tables from a FoxPro application. ... tables (put together a database) and send them to my customers. ... customer fill the database, and send it back to me. ...
    (comp.databases.ms-access)
  • Re: Nameless CREATE
    ... The starting point is either an existing database or one that is ... "Describe" involves issuing an SQLDescribeCol function to ODBC ... essentially much the same as character data type apart from all 8 bits ... ALTER TABLE tablename ADD COLUMN BinaryColumn BINARY ...
    (comp.lang.forth)