Conventions, names, and identifier case

The conventions are used in this appendix (in addition to the standard syntax conventions):

Note

Italicized square brackets indicate that the enclosed keyword or argument is optional—not bracketed to preserve case as described above. For example, table_alias (which is the syntax for the table_list argument for SELECT) in the following is enclosed in italicized square brackets because it is optional. Don’t use square brackets (or quotation marks) in a SELECT statement’s table list unless you want to preserve case.

[owner_name.]table_name [table_alias]

xfODBC supports identifiers (column names, table names, etc.) that are up to 30 characters long. Identifiers must start with an alphabetic character and can include numbers as well as the underscore characters (_). They can also include some special characters, such as the minus (-) and plus (+) signs, but if you use these, you must always put quotation marks (“ ”) around the identifier.

Note that identifiers are converted to all uppercase characters unless they are enclosed in quotation marks (“”) or square brackets ([]). (We recommend using quotation marks rather than brackets.) For example, table_name is converted to TABLE_NAME in the following:

SELECT * FROM table_name

However, both Col_name and Table_name in the following retain the specified capitalization:

SELECT [Col_name] FROM [Table_name]
SELECT "Col_name" FROM "Table_name"

In all cases, however, the case of the identifier must ultimately match the database entity that it refers to (column name, table name, and so forth). So, if you don’t use quotation marks or square brackets, the name of the database entity must be in all capital letters, and if you do use quotation marks or square brackets, the identifier’s capitalization must match the capitalization for the entity’s name. For example, the following will not work because the table alias is established as “O”, (capital letter) while the column name specifies “o” (lowercase):

SELECT "o".or_number FROM orders [O]