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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » SQL Anywhere database connections » Database file types » Additional dbspaces considerations » Dbspace creation

 

Creating a dbspace (SQL)

You can create a dbspace using the CREATE DATABASE statement. A single database file is enough for most databases, but additional dbspaces can be used to create more space for data.

Prerequisites

You must have the MANAGE ANY DBSPACE system privilege.

 Task
  • Execute a CREATE DBSPACE statement.

Results

The dbspace appears in the same directory as the main database file, unless otherwise specified.

Example

The following command creates a new dbspace called MyLibrary in the file library.db in the same directory as the main file:

CREATE DBSPACE MyLibrary
AS 'library.db';

The following command creates a table LibraryBooks and places it in the MyLibrary dbspace.

CREATE TABLE LibraryBooks (
title CHAR(100),
author CHAR(50),
isbn CHAR(30)
) IN MyLibrary;

The following commands create a new dbspace named MyLibrary, set the default dbspace to the MyLibrary dbspace, and then create the LibraryBooks table in the MyLibrary dbspace.

CREATE DBSPACE MyLibrary
AS 'e:\\dbfiles\\library.db';
SET OPTION default_dbspace = 'MyLibrary';
CREATE TABLE LibraryBooks (
  title CHAR(100),
  author CHAR(50),
  isbn CHAR(30),
);

 See also