Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement Too Long Error 1812
Message
From
10/09/1998 06:24:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/09/1998 13:03:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00134613
Message ID:
00134934
Views:
10
>Foxpro still has to substitute the macro stuff and when it does, it gets a command that is too long.
Jeremy,
Revisiting this thread I saw you posted the SQL. There most striking part is where clause :
mastcus->ccust = "11111" or ...
Seems you use old foxbase syntax for alias->field. Now you could cut it to "mastcus.ccust" to save one char per alias.field and furthere cut it to just "ccust" saving 8 more chars per expression.
ccust = "1111" && would be same as mastcus->ccust = "1111"
Well of course still it doesn't let you achieve the intended result. Now let's cut it more :
where mastcus->CCUST="03118" or mastcus->CCUST="03335" or mastcus->CCUST="03770"
* Could be written as
where ccust in ("03118","03335","03770")
So far so good, but still too cumbersome to accomplish task (if ever SQL wouldn't complain as "expression too complex"). I don't believe you write all those 100+ cust ids by hand. You should be collecting them via an interface, a multiselect combo, grid or whatever. In most you could insert them to a cursor as Kamal nicely suggested and your SQL cuts down in length and maintanence dramatically. Suppose you collect them via multiselectgrid class (in files\classes section - I don't mean to force you use it) the SQL would cut to :
* Assuming selector is thisform.multiselectgrid1
* It could be a modal selector form
select (your empty list here,*) from (thisform.multiselectgrid1.recorsource) ;
  where lSelected into cursor mastrepo
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform