You can change the primary key for the table that you are
creating. A primary key is a column or set of columns that can be
used to identify or access a particular row or rows. A primary key
is a unique key, that is, it is a key that is constrained so that
no two of its values are equal. A table cannot have more than one
primary key, and the columns of a primary key cannot contain null
values.
Before you begin
To
alter a table with a primary key, you must have at least one of the
following privileges on the table to be altered:
- ALTER privilege
- CONTROL privilege
- DBADM authority
- ALTERIN privilege on the schema of the table
Procedure
- To change primary keys using the Control Center:
- Open Change Primary Key window:
From the Control Center, expand the object tree until you find the Tables folder.
Right-click the Tables folder and select Create from
the pop-up menu. The Create Table wizard opens.
On the Keys page, select a primary key in the
table and click Change. The Change
Primary Key window opens.
- Select the column or columns that you want to define
as primary key columns. You can define up to 16 columns to be primary
key columns.
- Optional: Type the constraint name of the primary key.
- To change primary keys using the command line, use the
ALTER TABLE statement.