Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - Is LEFT an invalid field name?
Message
De
08/10/2009 08:30:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01428149
Message ID:
01428227
Vues:
50
>Compile or run this and you get a syntax error. It appears the field name left is not allowed. However, I was able to select it with SQL. This statement has 42 fields in my program and it took a while to narrow it down to this one field. Remove it and it runs, leave it in and CRASH! Anyone got any comments?
>
>
update pageobj ;
>set left = c_pageobj.left ;
>from c_pageobj ;
>where c_pageobj.k_pageobj = pageobj.k_pageobj ;
>and c_pageobj.k_page = pageobj.k_page
It is of course a reserved word and used as a function name and as a keyword (and as a property name as well). However VFP tables themselves use many keywords, meaning it is not carved in stone that you cannot use a keyword. You can use them, just it is not suggested you to do so.

Naomi,
I simply disagree that you can't use left there and the only way to update it to use a different fieldname. If we are talkking about VFP SQL then prefixing the fieldname with alias is the simple and easy way to write it:
update pageobj ;
set pageobj.left = c_pageobj.left ;
from c_pageobj ;
where c_pageobj.k_pageobj = pageobj.k_pageobj ;
and c_pageobj.k_page = pageobj.k_page
If SQL is used to mean SQL server then:
update pageobj ;
set pageobj.[left] = c_pageobj.[left] ;
from c_pageobj ;
where c_pageobj.k_pageobj = pageobj.k_pageobj ;
and c_pageobj.k_page = pageobj.k_page
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform