Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding [] brackets around field names in SELECT statemen
Message
De
03/12/2012 13:51:56
 
 
À
03/12/2012 12:50:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01558598
Message ID:
01558628
Vues:
51
Maybe I'll go the other way...

I could manually add [ ] brackets to the Select statement as I am writing it, then, at run time, if the statement will be running against a FoxPro DBF, I can easy remove the brackets with StrTran().

Are there any cases where a VFP Select statement is *supposed* to have brackets in there?



It's a little work to clean up the current batch of Select statements, but I could probably do this in a few hours, whereas I many NEVER achieve building a parser to add them in.

>coming in late I think Gregory is closest to what I want to propose,
>with the added twist of NOT writing your own parser, but perhaps enhance
>a classlib already in use to port/prepare SQL for/between different SQL dialects.
>- if there is such a beast in your fwk somewhere...
>
>These often have already the different clauses as separate properties/variables,
>so you have less worries of bracketing a clause-signifiyer
>
>have fun
>
>thomas
>
>>I am using wwBusiness to execute Select statements against SQL Server. I have tons of Select statements in my app from the time where it ran against FoxPro DBFs, but now I need these Sql Statements to run against SQL Server. I'm hoping someone has written a helpful function that would add brackets around all the table and field name in the query string.
>>
>>Does anyone know of a custom FoxPro procedure or regex that will automatically add brackets around all the table and field names in a SQL Select statement string?
>>
>>For instance:
>>
>>
>>Select mach_name, mach_num, order From Machines Where order < 100
>>
>>
>>Needs to become:
>>
>>Select  [mach_name], [mach_num], [order] From [Machines] Where [order] < 100
>>
>>
>>I also have Join, Order By, and Group By clauses in some of the Select statements that I need to get cleaned up as well.
>>
>>I'm trying to avoid adding brackets manually, because for a while the SQL statements still need to run against DBFs tables, so I if add them now, it will break the DBF version of the app. I know there are other VFP vs. Sql Server issues that I must address, but this is the biggest one I am facing now.
>>
>>
>>.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform