Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL expression too complex

Status
Not open for further replies.

Salmano

Programmer
Oct 4, 2001
34
0
0
RO
Hello all !
I get this error when I run the following sql:

SET ANSI ON
Select distinct ff.firma as Firma, iif(isnull(ob.obco), ' ', ob.obco) as ObAct
from rec\firma as ff
left join br_firma as bf on str(year(ff.dinrf), 4) + str(ff.nrinrf, 6) = bf.codu
left join br_obiect as ob on bf.codu = ob.codu
where alltrim(ob.obco) in ('0111', '011101', '01110101', '01110102', '01110103', '01110104', '01110105', '01110106', '01110107', '01110108', '01110109', '01110110', '01110111', '011102', '01110201', '01110202', '01110203', '011103', '01110301', '01110302', '01110303', '01110304', '01110305', '01110306', '0118', '011801', '01180101', '01180102', '01180103', '01180104', '011802', '01180201', '01180202', '01180203', '01180204', '011803', '01180301', '011804')
into cursor crs_rezult

Does anyone know how could I obtain my data (taking into consideration that the query runned by the users could get a lot more complex than this) and if the cause for the error is only that VFP 6.0 ran out of memory ?

Thank you.
Salmano.
 
Salmano,

There is a backslash in the first FROM clause. I would suspect that may be the problem (or at least a problem).

Stewart
 
Thank you Stewart,
but "rec" is a folder, and "firma" is a table. I can asure you that is no problem with that.

Salmano.
 

Salmano

I believe there is a limit as to how long (meaning how many characters ) you query can be. Try splitting your query in two. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike,
It crossed my mind there is a limit... but I could not accept it :)
I'll try to split my query in more that 2; the query results from the choices the user makes, and there are a lot; the user can choose the fields, the conditions, and the ordering, so ...

Thank you,
Salmano.
 
Salmano,
While I don't see that the help file says that the number values in your IN list is limited, INLIST() has a limit of 24. Therefore I'd guess that that's were your error message is comming from. In a case like this, I usually just place this list of values in a cursor, and use the IN (<subquery>) option.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top