Set the primary key to prohibit two or more rows in the table from having identical
values for a column or set of columns. You can set the primary key on base tables and global
temporary tables only.
Prerequisites
Database Version |
Table Privileges |
SAP Sybase IQ 15.3 and 15.4 |
Requires one of:- DBA authority.
- ALTER and REFERENCE permission on the table.
- You own the table.
|
SAP Sybase IQ
16.0 |
To create a new or modify an existing primary key - Requires one of:- ALTER ANY TABLE system privilege.
- ALTER ANY OBJECT system privilege.
- CREATE permission on the dbspace where the table resides.
- ALTER and REFERENCE permission on the table.
- You own the table.
To modify the name only of an existing primary key, requires
ALTER ANY INDEX system privilege.
|
Task- In the Perspective Resources view, select the resource and
select .
- In the Administration Console, expand .
- Select Tables or Global Temporary
Tables.
- Select a table from the right pane and either:
- Click the arrow to the right of the name and select Set Primary
Key, or
- From the Administration Console menu bar, select .
The Set Primary Key wizard appears.
- On the Constraint Name page of the wizard, specify the primary key name and click
Next.
If the table does not already have a primary key, the primary key name is
optional.
- On the Columns page, specify:
Option |
Description |
Add Asc. >> |
Moves columns from the Available Columns pane to the Selected Columns
pane, in ascending order. |
Add Desc. >> |
(IQ catalog store (system store) tables only.) Moves columns from the
Available Columns pane to the Selected Columns pane, in descending
order. |
<< Remove |
Moves columns from the Selected Columns pane to the Available Columns
pane. |
Select columns that do not allow NULL values.
- Click Next.
- (System store (IQ catalog store) tables only) On the clustered index page, specify:
Option |
Description |
Create a clustered primary key |
Select if you want to make the primary key's underlying index a clustered
index. Clustered indexes can improve performance. |
- Click Next.
- On the Comment page, add an optional, descriptive comment. Comments help you
organize your database.
- Click Finish to close the Set Primary Key wizard.