>I have a very long SELECT statement that uses a bunch of unions to create a table. I know that there is a limit to how many unions I can have, but is there a limit to how long the actual command can be? I seem to have passed it.
In VFP7 maximum # of characters per command line is 8,192. If you're hitting this limit I can think of a couple of approaches:
1. If you're using table names in your column select clauses, using short table aliases might shorten the whole statement enough to let it work:
SELECT
SomeTable.SomeField,
SomeOtherTable.SomeOtherField
FROM SomeTable, SomeOtherTable
...
SELECT
A.SomeField,
B.SomeOtherField
FROM SomeTable A, SomeOtherTable B
...
2. Instead of a massive UNION, you could do separate SELECTs and combine them manually yourself e.g.
SELECT ...
INTO CURSOR Temp1 READWRITE
SELECT ...
INTO CURSOR Temp2 NOFILTER
SELECT Temp1
APPEND FROM (DBF("Temp2"))
USE IN Temp2
SELECT
FROM Temp1
GROUP BY ...
ORDER BY ...
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up