Kbase P96723: How to work around Table and/or field names contain hyphens and/or underscore characters in SQL-92?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/22/2010 |
|
Status: Verified
GOAL:
How to work around Table and/or field names contain hyphens and/or underscore characters in SQL-92?
GOAL:
How to work around - hyphens in table or field names in SQL-92?
GOAL:
How to prevent errors with a SQL statement on tables and fields names containing hyphens and underscores
GOAL:
How to access VST or meta schema tables with a Select statement ?
SYMPTOM(s):
Syntax error (7587)
FACT(s) (Environment):
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems
FIX:
While Progress ABL/4GL allows table and field names to be created with with hyphens or underscore characters, under SQL92, neither table names nor field names may contain hyphens or underscore characters as dashes or hyphens in table or field names are considered special characters.
There are two ways to reference a table or field name with dashes or hyphens:
1. Enclose the table or field names with hyphenated table and field names in double quotes:
eg:
SELECT "cust-num" FROM PUB.customer;
SELECT "_name" from pub."_file";
2. Create a view to reflect the same table with all the fields selected. For Date Fields enclose them in single quotes.
eg:
SELECT * FROM pub.invoice WHERE "invoice-date" = '1993-02-08'