Subject Re: Max length of SQL statement
Author Paul R. Gardner
Actually I'm interested in his original question, the maximum length of
a statement. I have two separate Firebird databases. DB #1 contains a
SUPPLIER table for simplicity, lets say it just has: (ID integer; NAME
varchar(20)). DB #2 contains some invoice information in a table called
INVOICE. The INVOICE table contains the ID data only for the supplier.
This is because someone can rename the supplier name in the other
database and I cannot update the INVOICE table in its own database with
a trigger since FB doesn't support this. Multiple programs use DB 1,
but not DB 2 so it's not something that can be done with a client
application either.

When pulling invoice information, the application itself gets a list of
suppliers from DB 1. Typically this should be 20 - 50, but I suppose a
person could theoretically enter them in forever. The application then
constructs the SQL statement to select data from DB 2 using the
information it just pulled from DB 1 as follows:

select case ID
when 1 then 'ABC Supplier'
when 2 then 'DEF Supplier'
......
......
end, Many, Other, Invoice, Fields
From Invoice
Where ......
Order by 1

This allows the dataset returned to be sorted correctly and to run in a
Quick Report. It's worked fine so far, and I've not seen any cases over
100 suppliers (yet). Reasking his original question though, when will I
hit the limit?

Paul Gardner


[Non-text portions of this message have been removed]