Db2 object naming rules
Beyond the general naming rules, some additional rules apply to specific Db2 objects. These rules affect the naming of databases, aliases, instances, and objects within federated and non-federated databases.
Objects | Guidelines |
---|---|
|
Note: To avoid potential problems, do not use the special characters
@, #, and $ in a database name if you intend to use the database
in a communications environment. Also, because these characters
are not common to all keyboards, do not use them if you plan to use
the database in another language.
|
Objects | Guidelines |
---|---|
|
For more information, see Identifiers. |
Objects | Guidelines |
---|---|
|
Lengths for these
objects must be less than or equal to the lengths listed in: SQL
and XML limits. Names for federated database objects
can also include:
|
Delimited identifiers and object names
Keywords can be used. If a keyword is used in a context where it could also be interpreted as an SQL keyword, it must be specified as a delimited identifier.
Using delimited identifiers, it is possible to create an object that violates these naming rules; however, subsequent use of the object could result in errors. For example, if you create a column with a + or - sign included in the name and you subsequently use that column in an index, you will experience problems when you attempt to reorganize the table.
Additional schema names information
- User-defined types (UDTs) cannot have schema names longer than the lengths listed in: SQL and XML limits.
- The following schema names are reserved words and must not be used: SYSCAT, SYSFUN, SYSIBM, SYSSTAT, SYSPUBLIC.
- To avoid potential problems upgrading databases in the future, do not use schema names that begin with SYS. The database manager will not allow you to create triggers, user-defined types or user-defined functions using a schema name beginning with SYS.
- It is recommended that you not use SESSION as a schema name. Declared temporary tables must be qualified by SESSION. It is therefore possible to have an application declare a temporary table with a name identical to that of a persistent table, in which case the application logic can become overly complicated. Avoid the use of the schema SESSION, except when dealing with declared temporary tables.