Subject Re: Max length of SQL statement
Author Stephen Boyd
>
> I came up against this problem with a general-purpose user query
> module that could not predict the questions that were going to be
> asked. For certain columns that would generate a sizeable IN()
clause
> it now populates the following table:
>
> CREATE TABLE QRYCRITERIA
> (
> USERID INTEGER DEFAULT 0 NOT NULL ,
> CRITERIACOLUMN VARCHAR(50) DEFAULT '' NOT NULL,
> CRITERIAVALUE VARCHAR(255),
> ISMANDATORY INTEGER DEFAULT 0
> );
>
> And leads to queries of the form:
>
> SELECT c.contid, c.surname, c.forename, c.dob, c.postcode, c.filed,
> c.available, c.email
> FROM cont c
> JOIN QryCriteria q1 on (q1.userid=8 and
> q1.CRITERIACOLUMN='AREAID' and c.AREAID = q1.criteriavalue)
> ------------------------------------------------
>
Not a bad idea, but writing 1500+ entries to a table is going to
cause quite a performance hit. This would be a good place to use a
temporary, in memory table if Firebird supported such a thing.