Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a SQL statement on the fly
Message
De
12/09/1999 10:38:57
 
 
À
11/09/1999 23:08:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00263324
Message ID:
00263773
Vues:
28
>>>>I've got a class method that builds a SQL statement on the fly based on metadata. The field list has to be built dynamically before issuing the SQL call, as in:
>>>>
>>>>SELECT &lcFieldList ;
>>>> FROM &lcTable ;
>>>> INTO CURSOR lvNormalized
>>>>
>>>>The field list has to be dynamically built from a table of field mappings to normalize the data before moving it to a data warehouse. It all works fine, the hard part is done. But early on in testing I found that the lcFieldList variable can end up exceeding 254 characters, which generates an error. I've gotten around it in a cheesy kind of way, but I was wondering if anyone had any ideas on a more permanent solution.
>>>>
>>>>TIA
>>>
>>>Is it exceding 254 Characters or 254 Fields? Cause a string variable can contain like 16 million characters.
>>>
>>>BOb
>>
>>Yes, but there is a limit to the length of a command that can be executed with Macro substitution. Don't remember exactly, but 254 sounds like a good candidate.
>
>Ah... then he should probably build the whole SELECT statement into a string variable then execute it with the eval() function.
>
>BOb

Good thought, but you can ony use EVAL with expressions, not commands. Since a SQL SELECT is not a function that returns a value, it will give you a syntax error (or something...) when you try to eval it.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform