Rename Indexes
This topic describes how to rename an index in SQL Server 2014 by using SQL Server Management Studio or Transact-SQL. Renaming an index replaces the current index name with the new name that you provide. The specified name must be unique within the table or view. For example, two tables can have an index named XPK_1, but the same table cannot have two indexes named XPK_1. You cannot create an index with the same name as an existing disabled index. Renaming an index does not cause the index to be rebuilt.
In This Topic
Before you begin:
To rename an index, using:
Before You Begin
Limitations and Restrictions
When you create a PRIMARY KEY or UNIQUE constraint on a table, an index with the same name as the constraint is automatically created for the table. Because index names must be unique within the table, you cannot create or rename an index to have the same name as an existing PRIMARY KEY or UNIQUE constraint on the table.
Security
Permissions
Requires ALTER permission on the index.
Using SQL Server Management Studio
To rename an index by using the Table Designer
In Object Explorer, click the plus sign to expand the database that contains the table on which you want to rename an index.
Click the plus sign to expand the Tables folder.
Right-click the table on which you want to rename an index and select Design.
On the Table Designer menu, click Indexes/Keys.
Select the index you want to rename in the Selected Primary/Unique Key or Index text box.
In the grid, click Name and type a new name into the text box.
Click Close.
On the File menu, click Savetable_name.
To rename an index by using Object Explorer
In Object Explorer, click the plus sign to expand the database that contains the table on which you want to rename an index.
Click the plus sign to expand the Tables folder.
Click the plus sign to expand the table on which you want to rename an index.
Click the plus sign to expand the Indexes folder.
Right-click the index you want to rename and select Rename.
Type the index's new name and press Enter.
Using Transact-SQL
To rename an index
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
USE AdventureWorks2012; GO --Renames the IX_ProductVendor_VendorID index on the Purchasing.ProductVendor table to IX_VendorID. EXEC sp_rename N'Purchasing.ProductVendor.IX_ProductVendor_VendorID', N'IX_VendorID', N'INDEX'; GO
For more information, see sp_rename (Transact-SQL).