Use this statement to define a new database space and create the associated database file.
CREATE DBSPACE dbspace-name AS filename
dbspace-name Specify a name for the dbspace. This is not the actual database file name, which you specify using filename. dbspace-name is an internal name you can refer to, for example in statements and procedures. You cannot use the following names for a dbspace because they are reserved for pre-defined dbspaces: system, temporary, temp, translog, and translogmirror. See Pre-defined dbspaces.
An error is returned if you specify a value that contains a period (.).
filename Specify a name for the database file, including, optionally, the path to the file. If no path is specified, the database file is created in the same location (directory) as the main database file. If you specify a different location, the path is relative to the database server. The backslash ( \ ) is an escape character in SQL strings, so each backslash must be doubled. For more information about escape characters and strings, see Strings.
The filename parameter must be either a string literal or a variable.
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 object, such as a table or index, is contained entirely within one dbspace. The IN clause of the CREATE statement specifies the dbspace into which an object is placed. Objects are put into the system 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.
For information about how the default dbspace for a database object is determined, see Using additional dbspaces.
Must have DBA authority.
Automatic commit. Automatic checkpoint.
SQL/2003 Vendor extension.
The following CREATE DBSPACE statement creates a dbspace called libbooks. The database file name for the dbspace is library.db, located in the c:\ directory. A subsequent CREATE TABLE statement creates a table called LibraryBooks in the libbooks dbspace.
CREATE DBSPACE libbooks AS 'c:\\library.db'; CREATE TABLE LibraryBooks ( title char(100), author char(50), isbn char(30), ) IN libbooks; |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |