Modify an Index
Updated: February 17, 2017
This topic describes how to modify an index in SQL Server 2016 by using SQL Server Management Studio or Transact-SQL.
In This Topic
In Object Explorer, connect to an instance of the SQL Server Database Engine 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 Database Engine.
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 the
Production.WorkOrdertable by using the
DROP_EXISTINGoption. The options
PAD_INDEXare also set.
USE AdventureWorks2012; GO CREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID ON Production.WorkOrder(ProductID) WITH (FILLFACTOR = 80, PAD_INDEX = ON, DROP_EXISTING = ON); GO
The following example uses ALTER INDEX to set several options on the index
- To add, remove, or change the position of an index column, you must drop and recreate the index.