Identifiers

Identifiers are names of objects in the database, such as user IDs, tables, and columns.

Identifiers have a maximum length of 128 bytes. They must be enclosed in double quotes or square brackets if any of these conditions are true:

  • The identifier contains spaces.

  • The first character of the identifier is not an alphabetic character (as defined below).

  • The identifier contains a reserved word.

  • The identifier contains characters other than alphabetic characters and digits.

    Alphabetic characters include the alphabet, as well as the underscore character (_), at sign (@), number sign (#), and dollar sign ($). The database collation sequence dictates which characters are considered alphabetic or digit characters.

Note: These characters are not allowed inside an identifier:
  • [ – square bracket (open)
  • ] – square bracket (close)
  • ` – back tick / grave accent

You can represent an apostrophe (single quote) inside an identifier by following it with another apostrophe.

If the QUOTED_IDENTIFIER database option is set to OFF, double quotes are used to delimit SQL strings and cannot be used for identifiers. However, you can always use square brackets to delimit identifiers, regardless of the setting of QUOTED_IDENTIFIER.

The default setting for the QUOTED_IDENTIFIER option is OFF for Open Client and jConnect connections; otherwise the default is ON.

Limitations

Identifiers have the following limitations:
  • Table names cannot contain double quotes.

  • User names cannot contain double quote or semi-colon characters (single quote characters are allowed).

  • Database names cannot contain double quote, single quote, and semi-colon characters.

  • User names and database names cannot start or end with a space.

  • Dbspace names are always case-insensitive, regardless of the CREATE DATABASE...CASE IGNORE or CASE RESPECT specification.

Database server naming restrictions exist when using the -n start_iq server option.

Examples

The following are all valid identifiers.

Surname 
"Surname" 
[Surname] 
SomeBigName 
"Client Number"
Related concepts
The quoted_identifier Option
Subqueries in Search Conditions
Column Names in Expressions
Related reference
Reserved Words