Re: Maximum length of SQL statement in Delphi
Posted by Vincent on July 21, 2004 at 13:16:06:
In Reply to: Re: Maximum length of SQL statement in Delphi posted by webmaster Guido on July 21, 2004 at 12:49:59:
: : Hi everyone. Does anyone know of a way to overcome the 4095 character (4K) limit of a SQL statement? I need to code a very long SQL statement, using a TQuery component, adding lines by means of query1.SQL.Add(). I am thinking that this may be a BDE limitation. Any suggestions would be appreciated.
: It's a limitation of Delphi's BDE. Limits of according to Borland:
: 64K Size of SQL statement (RequestLive=False)
: Alternative: code it yourself. Using a TTable component, step through all the records and copy the records that meet your conditions to a temporary table. Next, work with the temporary table.
: var Cond1, Cond2, Cond3: Boolean;
: while not Table1.EOF do begin
: This technique is also useful for debugging any large SQL statement. Even if it's not too big for Delphi, it might be too complex for the programmer. So, replace it with Pascal code and now you can add calculations to check values, set breakpoints, step through the code,... whatever is necessary to pinpoint the error.