ALTER INDEX Statement

Renames indexes in base or global temporary tables, foreign key role names of indexes and foreign keys explicitly created by a user, or changes the clustered nature of an index on a catalog store table.

Syntax

ALTER { INDEX index-name[ INDEX ] FOREIGN KEY role-name[ INDEX ] PRIMARY KEYON [owner.]table-name   { rename-clause | move-clause | cluster-clause} 

Parameters

Examples

Usage

The ALTER INDEX statement renames indexes and foreign key role names of indexes and foreign keys that were explicitly created by a user. Only indexes on base tables or global temporary tables can be renamed. You cannot rename indexes created to enforce key constraints.

Side effects:
  • Automatic commit. Clears the Results tab in the Results pane in Interactive SQL. Closes all cursors for the current connection.

Standards

  • SQL—ISO/ANSI SQL compliant.

  • Sybase—Not supported by Adaptive Server Enterprise.

Permissions

move-clause requires one of:
  • MANAGE ANY DBSPACE system privilege.
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • REFERENCE privilege on the table.
  • You own the underlying table.
  • REFERENCE privilege on the table along with one of:
    • CREATE ANY OBJECT system privilege.
    • CREATE privilege on the target dbspace.
cluster-clause for materialized view requires one of:
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • You own the materialized view.
cluster-clause for all other indexes, requires one of:
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • ALTER and REFERENCE privilege on the table.
  • You own the table.
Any other clauses require one of:
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • REFERENCE privilege on the table.
  • You own the underlying table.
Related reference
ALTER TABLE Statement
CREATE INDEX Statement
CREATE TABLE Statement