| title | Modify an Index | Microsoft Docs | |||
|---|---|---|---|---|
| ms.custom | ||||
| ms.date | 06/13/2017 | |||
| ms.prod | sql-server-2014 | |||
| ms.reviewer | ||||
| ms.technology | table-view-index | |||
| ms.topic | conceptual | |||
| helpviewer_keywords |
|
|||
| ms.assetid | 97e3110d-fde7-4f5d-9309-dc1697960aeb | |||
| author | MikeRayMSFT | |||
| ms.author | mikeray | |||
| manager | craigg |
This topic describes how to modify an index in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].
Important
Indexes created as the result of a PRIMARY KEY or UNIQUE constraint cannot be modified by using this method. Instead, the constraint must be modified.
In This Topic
-
To modify an index, using:
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion] and then expand that instance.
-
Expand Databases, expand the database in which the table belongs, and then expand Tables.
-
Expand the table in which the index belongs and then expand Indexes.
-
Right-click the index that you want to modify and then click Properties.
-
In the Index Properties dialog box, make the desired changes. For example, you can add or remove a column from the index key, or change the setting of an index option.
- To add, remove, or change the position of an index column, select the General page from the Index Properties dialog box.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example drops and re-creates an existing index on the
ProductIDcolumn of theProduction.WorkOrdertable by using theDROP_EXISTINGoption. The optionsFILLFACTORandPAD_INDEXare also set.[!code-sqlIndexDDL#CreateIndex4]
The following example uses ALTER INDEX to set several options on the index
AK_SalesOrderHeader_SalesOrderNumber.[!code-sqlIndexDDL#AlterIndex4]
- To add, remove, or change the position of an index column, you must drop and recreate the index.
CREATE INDEX (Transact-SQL)
ALTER INDEX (Transact-SQL)
INDEXPROPERTY (Transact-SQL)
sys.indexes (Transact-SQL)
sys.index_columns (Transact-SQL)
Set Index Options
Rename Indexes