Long SQL queries 
Author Message
 Long SQL queries

Hi,

I have some problems using the SQL-table object in Delphi. Normally it works just
fine, but it seems like if the SQL statement gets above a certain size (measured
in characters) the DB-engine perfoms an illegal memory-call and is then terminated
by Windows.

Is there any way to defeat this? I mean - it seems like there is a limit of 255 chars
or so - but that just really can't be true, can it?

Thanks a lot for your help!!

** Lars



Sun, 21 Jun 1998 03:00:00 GMT  
 Long SQL queries

Quote:

>I have some problems using the SQL-table object in Delphi. Normally it works
> just fine, but it seems like if the SQL statement gets above a certain size
>(measured>in characters) the DB-engine perfoms an illegal memory-call and is
>then terminated by Windows.

>Is there any way to defeat this? I mean - it seems like there is a limit
>of 255 chars or so - but that just really can't be true, can it?

There is a limit of 255 characters for each line of SQL but you can
have as many lines as you want so you need to split the query into
several lines. I usually keep lines down to about 60 characters for
readability anyway.

--
Donald Oddy
Grove Systems Ltd.                                    0161-224 4465



Thu, 25 Jun 1998 03:00:00 GMT  
 Long SQL queries
Hi Lars,

Quote:
>I have some problems using the SQL-table object in Delphi. Normally it works just
>fine, but it seems like if the SQL statement gets above a certain size (measured
>in characters) the DB-engine perfoms an illegal memory-call and is then terminated
>by Windows.
>Is there any way to defeat this? I mean - it seems like there is a limit of 255 chars
>or so - but that just really can't be true, can it?

The TQuery component uses a TString to store the SQL statament.
TString uses a TStringList to store the data.
This means your SQL statament can be as long as you need, but must be
made of  255 chars (max lenght) pieces.

This code truncate  to 255 your SQL statament:
Query1.SQL.Clear;
Query1.SQL.Add ('select * from atable where afield="this is a very
long statement etc etc more then 255 chars"');
Query1.Open;

This code works:
Query1.SQL.Clear;
Query1.SQL.Add ('select * from atable ');
Query1.SQL.Add (' where afield="this is a very long ');
Query1.SQL.Add ('statement etc etc more then 255 chars"');
Query1.Open;

Hope it helps,
        Corrado.
Corrado Labinaz        
Vicenza (Italy)

fidonet:   2:333/209.6



Sat, 27 Jun 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Does anybody know how to interrupt long SQL query?

2. UK query - Delphi3 - NT4-Memory leak on SQL Query to SQL/server 6.5

3. Help with long strings as query parameters

4. Long queries

5. Long queries and progress or SOMETHING...Geezzzzz...Can SOMEONE help me out here

6. help: querying the results of a SQL Query...

7. Local sql, query on query problem

8. Help w/ long query

9. D1: Query's Expression too long???

10. Query of a query (with Local SQL)...?

11. Long running query in oracle

12. Progress of a long query

 

 
Powered by phpBB® Forum Software