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. You cannot rename indexes created to enforce key constraints.

Syntax

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

rename-clause:
   RENAME TO | AS new-name

move-clause:
   MOVE TO dbspace-name

cluster-clause:
   CLUSTERED | NONCLUSTERED

Parameters

Examples

Usage

You must have CREATE privilege on the new dbspace and be the table owner or have the MANAGE ANY DBSPACE system privilege.
Note: Attempts to alter an index in a local temporary table return the error index not found. Attempts to alter a nonuser-created index, such as a default index (FP), return the error Cannot alter index. Only indexes in base tables or global temporary tables with an owner type of USER can be altered.
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 for materialized view requires one of:
  • MANAGE ANY DBSPACE system privilege.
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • You own the materialized view along with one of:
    • CREATE ANY OBJECT system privilege.
    • CREATE privilege on the target dbspace.
move-clause for all other indexes requires one of:
  • MANAGE ANY DBSPACE system privilege.
  • ALTER ANY INDEX system privilege.
  • ALTER ANY OBJECT system privilege.
  • You own the underlying table or have 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.
  • REFERENCE privilege on the table.
  • You own the table.
All 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.