Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I avoid 'SQL: Statement too long (Error 1812)'
Message
From
13/11/2003 13:39:38
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
To
13/11/2003 12:57:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00849187
Message ID:
00849611
Views:
33
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform