Using CREATE DATABASE

From InterBase
Jump to: navigation, search

Go Up to Creating a Database (Data Definition Guide)


CREATE DATABASE establishes a new database and populates its system tables, which are the tables that describe the internal structure of the database. CREATE DATABASE must occur before creating database tables, views, and indexes.

CREATE DATABASE optionally allows you to do the following:

  • Specify a user name and a password
  • Change the default page size of the new database
  • Specify a default character set for the database
  • Add secondary files to expand the database

CREATE DATABASE must be the first statement in the data definition file.

Important: In DSQL, CREATE DATABASE can be executed only with EXECUTE IMMEDIATE. The database handle and transaction name, if present, must be initialized to zero prior to use.

The syntax for CREATE DATABASE is:

CREATE {DATABASE | SCHEMA} 'filespec'
 [USER 'username' [PASSWORD 'password']]
 [PAGE_SIZE [=] int]
 [LENGTH [=] int [PAGE[S]]]
 [DEFAULT CHARACTER SET charset]
 [<secondary_file>]
[WITH ADMIN OPTION];
<secondary_file> = FILE 'filespec' [<fileinfo>] [<secondary_file>]
<fileinfo> = LENGTH [=] int [PAGE[S]] | STARTING [AT [PAGE]] int
 [<fileinfo>]
Important: Use single quotes to delimit strings such as file names, user names, and passwords.

Topics