Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How long can a SQL statement be?
Message
From
09/08/2000 08:44:59
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
03/08/2000 20:44:30
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00400812
Message ID:
00402735
Views:
9
Ulises,

Here's a method that has worked well for long SQL. I do a lot of SQL pass-through also, so I use this in both situations.

Build your SQL statement in pieces as strings and use macro expansion to actually execute it. I use a lot of [ and ] as delimiters, to save on problems with single and double quotes, also.
cMySelect = [SELECT blah blah ] + ;
    [more blah blah ]
cMyFrom = [FROM this file ] + ;
    [and some other files, joined ]
cMyWhere = [WHERE some criteria ] + ;
    [and some other criteria ]
cMyGroupOrder = [GROUP BY something ] + ;
    [and something else and ] + ;
    [ORDER BY my order ]

cMySQLStatement = ;
    cMySelect + ;
    cMyFrom + ;
    cMyWhere + ;
    cMyGroupOrder

&cMySQLStatement
Even though you've carved off a few characters and gotten under the limit, you'll run into this again.




>I have a grid populated by a SQL Statement. I need 9 fields there.
>It works fine as long as I "Select (8 fields)..." as soon as I try to add the 9th field, I get a "Command contains unrecognized phrase/keyword" error message. I'm positive that my syntax is correct.
>What is the problem?
>Thank you for your time.
>
>Ulises.
Previous
Reply
Map
View

Click here to load this message in the networking platform