<< Click to Display Table of Contents >> Names and reserved words |
![]() ![]() ![]() |
One of the areas that may cause problems when converting a DBF app to SQL is the area of reserved words.
In a SQL environment a large number of words are treated as reserved words, and may not be used as column names, table names or index names.
An example of some reserved words
TABLE
INDEX
COLUMN
GROUP
USER
Workaround
The easiest work around for this is usually to prefix or suffix the column names with a character or the underscore sign.
If you don't want to change your existing code, you can then use the Field alias mechanism to define alias in VO that have the original field name.
For example, consider a DBF file with field names GROUP and USER. DUring the conversion to the SQL database the field names have been changed to _GROUP and _USER. If you don't want to change your code, you can set an alias for the two columns and still refer to them as GROUP and USER:
oSrv := DbServer{"GrpMember"}
oSrv:FieldInfo(DBS_ALIAS, oSrv:FIELDPOS("_GROUP"), "GROUP")
oSrv:FieldInfo(DBS_ALIAS, oSrv:FIELDPOS("_USER") , "USER")
? oSrv:FieldGet(#Group)
? oSrv:FieldGet(#User)