Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding [] brackets around field names in SELECT statemen
Message
 
 
À
03/12/2012 10:30:24
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:
01558603
Vues:
78
>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.
>

Why do you need brackets around the fields when working with SQL Server? I think you only need the brackets if the field name is a reserved word in SQL Server.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform