Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I avoid 'SQL: Statement too long (Error 1812)'
Message
 
 
À
13/11/2003 13:39:38
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00849187
Message ID:
00849621
Vues:
36
Mike,
VFP 8 provides a link at the bottom of the page to send feeback to MS about the documentation. Please use it if you have a problem with the docs.

Having said that, if you go to the Search tab in the VFP Help and type in "SQL statement too long" in quotes, the first topic returned is SYS(3055) - FOR and WHERE clause complexity. Sometimes, it's simply a matter of looking at something another way.

Regards.

>Hi Fabio,
>
>Thank you for sharing this very useful information. This is the kind of stuff that the online VFP help should lead to but doesn't.
>
>I tried to look up the Error "SQL Statement too long" in the online Help and all it says is:
>
>
The object code is too long to be compiled. For more information, see SELECT - SQL.
>
>If you go to the SELECT - SQL link there is no mention of SYS(3055) either. How #$%@! helpful is that!
>
>Thanks again for your help.
>
>Mike
>
>
>>Hi Mike,
>>
>>-----
>>My string is only 1844 characters and I get the error. Any ideas as to why?
>>
>>
>>VFP SQL SELECT command have another limit, complexity on the stack of the parser.
>>
>>This is controlled by
>>
>>SYS(3055 , nComplexity) && READ HELP
>>
>>
>>A simple example :
>>
>>SET TALK OFF
>>CLEAR
>>
>>CREATE CURSOR C1 (Id I DEFAULT RAND()*1000)
>>FOR K=1 TO 1000
>> APPEND BLANK
>>NEXT
>>
>>n=1020   && change this on range 160..1020
>>
>>* 1 IN() item use 1 stack position
>>* OR id IN  use 2 stack positions
>>
>>maxItem =  m.n-14 - 2*INT((m.n-157)/26)
>>
>>? maxItem
>>sSelect = ''
>>FOR k=1 TO m.maxItem
>>  sSelect = m.sSelect + " OR ID IN (" + LTRIM(STR(m.k))
>>  FOR k=m.k+1 TO MIN(m.k+22,m.maxItem -1)
>>    sSelect = m.sSelect + "," + LTRIM(STR(m.k))
>>  ENDFOR
>>  sSelect = m.sSelect + IIF(m.k>m.maxItem,"","," + LTRIM(STR(m.k)))+")"
>>NEXT
>>sSelect = STUFF(m.sSelect,1,3,"SELECT id from C1 WHERE")
>>
>>SYS(3055 , m.n*2)	&& 2x is a VFP error on first implementation choice 160..1020 range x 2
>>
>>? m.sSelect
>>&sSelect
>>
>>
>>Then, try SYS(3055,2040) on your query.
>>
>>Fabio
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform