Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Statements

CREATE DATABASE statement Next Page

CREATE DBSPACE statement


Use this statement to define a new database space and create the associated database file.

Syntax

CREATE DBSPACE dbspace-name AS file-name

Parameters

dbspace-name    An internal name for the database file. The file-name parameter is the actual name of the database file, with a path where necessary. You cannot use the following names for a dbspace because they are used for the pre-defined dbspaces: SYSTEM, TEMPORARY, TEMP, TRANSLOG, and TRANSLOGMIRROR. See Pre-defined dbspaces.

file-name    A file-name without an explicit directory is created in the same directory as the main database file. Any relative directory is relative to the main database file. The file-name is relative to the database server. When you are using the database server for NetWare, the file-name should use a volume name (not a drive letter) when an absolute directory is specified.

Remarks

The CREATE DBSPACE statement creates a new database file. When a database is created, it is composed of one file. All tables and indexes created are placed in that file. CREATE DBSPACE adds a new file to the database. This file can be on a different disk drive than the main file, which means that the database can be larger than one physical device.

For each database, there is a limit of twelve dbspaces in addition to the main file.

Each table is contained entirely within one database file. The IN clause of the CREATE TABLE statement specifies the dbspace into which a table is placed. Tables are put into the main database file by default. You can also specify which dbspace tables are created in by setting the default_dbspace option before you create the tables.

Permissions

Must have DBA authority.

Side effects

Automatic commit. Automatic checkpoint.

See also
Standards and compatibility
Example

Create a dbspace called library to hold the LibraryBooks table and its indexes.

CREATE DBSPACE library
AS 'c:\\library.db';
CREATE TABLE LibraryBooks (
  title char(100),
  author char(50),
  isbn char(30),
) IN library;