Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(3055) in VFP 5 ?
Message
From
19/03/1999 08:37:40
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00199670
Message ID:
00199682
Views:
11
>I am writing a mover class for VFP 5. This class will return a string with a SQL statement like the following:
>
> SELECT x
> FROM y
> WHERE pk=selecteditem1 or pk=selecteditem2 or
> pk=selecteditem3 or...
>
>My problem is that if the user select too many elements in the mover then the return string cannot be executed in VFP because I get the error 1812 "SQL: Statement too long".
>
>In VFP 6 I can use the SYS(3055) function to work around the problem, however that does not work in VFP 5.
>
>In VFP 5 I can create a read-only view with the return string (even if the string is too long), however when I try to open the view then I get the same error 1812.
>
>Any ideas on how to work around this error 1812 in VFP 5?

No way to extend the length of a command line in VFP5.0.

However you could try to reduce the length of your SQL statement using the INLIST.
SELECT x
FROM y
WHERE INLSIT(pk,selecteditem1,selecteditem2,selecteditem3)

If this line is still too long.

You could create a cursor that holds your selection criteria.
create cursor crsSelCrit (iPk I), a cursor with 1 integer field.
insert your criteria in this cursor.
insert into csrSelCrit (iPK) values (selecteditem1)
insert into csrSelCrit (iPK) values (selecteditem2)
insert into csrSelCrit (iPK) values (selecteditem3)

Now build the query using a subquery.
SELECT x FROM y WHERE pk IN (SELECT iPk from crsSelCrit)
or just simply
SELECT x FROM y, crsSelCrit WHERE pk = iPk
Previous
Reply
Map
View

Click here to load this message in the networking platform