602SQL Documentation Index  

Identifiers and Reserved Words in SQL

Identifier Notation

Standard Identifier Notation

Standard identifiers in the SQL language begin with a letter or with an underline ("_") and may contain letters, numbers and underlines.

International characters that belong to the system charset on the server are also acceptable.

Example: I, new_value.

Identifiers Containing Non-Alphanumeric Characters

If the identifier contains non-alphanumeric characters, it must be enclosed special delimiters. Single quote or double quotes can be used as the delimiters. In order to use quotation marks, you must set the SQL compatibility attributes correctly using the Set_sql_option procedure (SQLOPT_QUOTED_IDENT option).

A delimiter cannot be used inside an identifier.

Example: "Reader's digest", `UPDATE`.

Identifiers Containing Characters that Cannot be Entered

There are characters that can be part of an identifier, but cannot be entered into the statement, because they are not on the keyboard. You can use an Unicode escape sequence for entering these characters, where each occurrence of the character is replaced with the Unicode character code. U& must always be before the identifier. Unicode escape sequence always begins with the opening Unicode Escape character and contain 4 hexadecimal digits.

Example: U&`poci\0105g`, U&`po*0142owa`UESCAPE'*' (the same as pociąg, połowa).

Identifier Properties

Identifiers may contain only characters from the database system charset.

The maximum number of characters in an identifier is 31. Identifiers are not case-sensitive.

Standard identifiers must differ from reserved words. The following words are reserved:

"ADD", "AFTER", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUTHOR", "AUTOR", "AVG", "BEFORE", "BEGIN", "BETWEEN", "BIGINT", "BINARY", "BIPTR", "BIT", "BLOB", "BOOLEAN", "BY", "CALL", "CASCADE", "CASE", "CAST", "CHAR", "CHARACTER", "CHECK", "CLOB", "CLOSE", "COALESCE", "COLLATE", "COMMIT", "CONCAT", "CONDITION", "CONSTANT", "CONSTRAINT", "CONTINUE", "CORRESPONDING", "COUNT", "CREATE", "CROSS", "CURRENT", "CURSOR", "DATE", "DATIM", "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DELETE", "DESC", "DISTINCT", "DIV", "DO", "DOUBLE", "DROP", "ELSE", "ELSEIF", "END", "ESCAPE", "EXCEPT", "EXISTS", "EXIT", "EXTERNAL", "FETCH", "FLOAT", "FOR", "FOREIGN", "FROM", "FULL", "FUNCTION", "GRANT", "GROUP", "HANDLER", "HAVING", "HISTORY", "IF", "IN", "INDEX", "INNER", "INOUT", "INSERT", "INT", "INTEGER", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "LARGE", "LEAVE", "LEFT", "LIKE", "LONG", "LOOP", "MAX", "MIN", "MOD", "NATIONAL", "NATURAL", "NCHAR", "NOT", "NULL", "NULLIF", "NUMERIC", "OBJECT", "OF", "ON", "OPEN", "OR", "ORDER", "OTHERS", "OUT", "OUTER", "POINTER", "PRECISION", "PRIMARY", "PROCEDURE", "PUBLIC", "REAL", "REDO", "REFERENCES", "REFERENCING", "RELEASE", "REPEAT", "RESIGNAL", "RESTRICT", "RETURN", "RETURNS", "REVOKE", "RIGHT", "ROLLBACK", "SAVEPOINT", "SELECT", "SET", "SIGNAL", "SIGNATURE", "SMALLINT", "SOME", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "START", "SUM", "TABLE", "THEN", "TIME", "TIMESTAMP", "TO", "TRIGGER", "TUPLE", "UNDO", "UNION", "UNIQUE", "UNTIL", "UPDATABLE", "UPDATE", "USER", "USING", "VALUES", "VARBINARY", "VARCHAR", "VARYING", "VIEW", "WHEN", "WHERE", "WHILE", "WITH".

602SQL Variances