Where to Specify Data Types

From InterBase
Jump to: navigation, search

Go Up to Specifying Data Types


A data type is assigned to a column in the following situations:

  • Creating a table using CREATE TABLE.
  • Adding a new column to a table or altering a column using ALTER TABLE.
  • Creating a global column template using CREATE DOMAIN.
  • Modifying a global column template using ALTER DOMAIN.

The syntax for specifying the data type with these statements is provided here for reference.

<datatype> =
 {SMALLINT | INTEGER | FLOAT | DOUBLE PRECISION} [<array_dim>]
| {DATE | TIME | TIMESTAMP} [<array_dim>]
| {DECIMAL | NUMERIC} [(precision [, scale])] [<array_dim>]

 | {CHAR | CHARACTER | CHARACTER VARYING | VARCHAR} [(int)]
 [<array_dim>] [CHARACTER SET charname]
| {NCHAR | NATIONAL CHARACTER | NATIONAL CHAR}
 [VARYING] [(int)] [<array_dim>]
| BLOB [SUB_TYPE {int
| subtype_name}] [SEGMENT SIZE int]
 [CHARACTER SET charname]
| BLOB [(seglen [, subtype])]

For more information on how to create a data type using CREATE TABLE and ALTER TABLE, see Working with Tables. For more information on using CREATE DOMAIN to define data types, see Working with Domains.