Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a SQL statement on the fly
Message
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:
00263593
Vues:
27
Hi!

I suggest you to write a macros like this:

SQLMAC = "Select "

FOR....
SQLMAC = SQLMAC + Fields(ix) + ","
ENDFOR

SQLMAC = LEFT(SQLMAC, LEN(SQLMAC)-1) && cut the last ,

SQLMAC = SQLMAC + " From "
.....

* finally execute it by single macro
&SQLMAC




I agree that string macros is limited at 254 character BUT direct macros run has
higher limit!

If you have download foxcmd at file section, you may try before the limitation on macros
command is 254 as it is a string macros there! but of cos already enough to use!




>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
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform