Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Statements

ALTER FUNCTION statement Next Page

ALTER INDEX statement

Use this statement to rename an index, primary key, or foreign key, or to change the clustered nature of an index.


ALTER { INDEX index-name
| [ INDEX ] FOREIGN KEY role-name
ON [ owner.]object-name { REBUILD | rename-clause | cluster-clause } }

object-name : table-name | materialized-view-name

rename-clause : RENAME { AS | TO } new-index-name



rename-clause    Specify the new name for the index, primary key, or foreign key.

cluster-clause    Specify whether the index should be changed to CLUSTERED or NONCLUSTERED. Only one index on a table can be clustered.

REBUILD clause    Use this clause to rebuild an index, instead of dropping and recreating it.


The ALTER INDEX statement carries out two tasks:

ALTER INDEX cannot be used to change an index on a local temporary table. An attempt to do so will result in an Index not found error.


Must own the table, or have REFERENCES permissions on the table or materialized view, or have DBA authority.

Cannot be used within a snapshot transaction. See Snapshot isolation.

Side effects

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

See also
Standards and compatibility

The following statement renames the index IX_product_name on the Products table to ixProductName:

ALTER INDEX IX_product_name ON Products
RENAME TO ixProductName;

The following statement changes IX_product_name to be a clustered index:

ALTER INDEX IX_product_name ON Products