SQL Rename Table Index

Renaming Indexes

Syntax for changing the name of an index can varies from RDBMS to RDBMS, so check your system manuals for specifics.
Syntax:
Oracle, PostgreSQL:
ALTER INDEX old_name RENAME TO new_name;
Example:
ALTER INDEX Fullname RENAME TO First_Last_Name;
ALTER INDEX [ IF EXISTS ] Fullname RENAME TO First_Last_Name; /* ONLY PostgreSQL*/

If the DBMS does not have this alter index option we have to remove the index and recreate it with a new name.

Syntax:
MySQL, SQL server:
DROP INDEX old_name ON table_name;
CREATE INDEX new_name ON table_name (column_name1,column_name2,...);
Example:
DROP INDEX Fullname ON CUSTOMER ;
CREATE INDEX First_Last_Name ON Customer (First_name, Last_Name);

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.