Sybase 12.4.2 manual Working with tables, Dropping a database, Creating tables, 118

Models: 12.4.2

1 536
Download 536 pages 20.34 Kb
Page 138
Image 138

Working with tables

Dropping a database

Dropping a database deletes all tables and data from disk, including the transaction log that records alterations to the database. It also drops all of the dbspaces associated with the database.

To drop a database, use the following statement:

DROP DATABASE dbname

You must specify the database name and its pathname exactly as they were specified when the database was created.

For example, on a Windows NT system:

DROP DATABASE ’c:\sybase\data\mydb.db’

The database must be stopped before you can drop it. If the connection parameter AUTOSTOP=no is used, you may need to issue a STOP DATABASE statement.

Working with tables

When you create a database, the only tables in it are the system tables, which hold the database schema.

This section describes how to create, alter, and delete tables from a database. The examples can be executed in DBISQL, but the SQL statements are independent of the administration tool you are using.

You may want to create command files containing the CREATE TABLE and ALTER TABLE statements that define the tables in your database. The command files allow you to re-create the database when necessary. They also let you create tables in a standardized way, which you can copy and revise.

Creating tables

Creating tables in

Sybase Central provides a tool called the table editor. In the table editor, you

Sybase Central

can create a table definition by filling out a spreadsheet-like form.

 

 

To create a table using Sybase Central:

 

1 Connect to the database.

118

Page 138
Image 138
Sybase 12.4.2 manual Working with tables, Dropping a database, Creating tables, 118