| title | Set Index Options | 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 | 7969af33-e94c-41f7-ab89-9d9a2747cd5c | ||||||||||||
| author | MikeRayMSFT | ||||||||||||
| ms.author | mikeray | ||||||||||||
| manager | craigg |
This topic describes how to modify the properties of an index in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql].
In This Topic
-
Before you begin:
-
To modify the properties of an index, using:
-
The following options are immediately applied to the index by using the SET clause in the ALTER INDEX statement: ALLOW_PAGE_LOCKS, ALLOW_ROW_LOCKS, IGNORE_DUP_KEY, and STATISTICS_NORECOMPUTE.
-
The following options can be set when you rebuild an index by using either ALTER INDEX REBUILD or CREATE INDEX WITH DROP_EXISTING: PAD_INDEX, FILLFACTOR, SORT_IN_TEMPDB, IGNORE_DUP_KEY, STATISTICS_NORECOMPUTE, ONLINE, ALLOW_ROW_LOCKS, ALLOW_PAGE_LOCKS, MAXDOP, and DROP_EXISTING (CREATE INDEX only).
Requires ALTER permission on the table or view.
-
In Object Explorer, click the plus sign to expand the database that contains the table on which you want to modify an index's properties.
-
Click the plus sign to expand the Tables folder.
-
Right-click the table on which you want to modify an index's properties and select Design.
-
On the Table Designer menu, click Indexes/Keys.
-
Select the index that you want to modify. Its properties will show up in the main grid.
-
Change the settings of any and all properties to customize the index.
-
Click Close.
-
On the File menu, select Savetable_name.
-
In Object Explorer, click the plus sign to expand the database that contains the table on which you want to modify an index's properties.
-
Click the plus sign to expand the Tables folder.
-
Click the plus sign to expand the table on which you want to modify an index's properties.
-
Click the plus sign to expand the Indexes folder.
-
Right-click the index of which you want to modify the properties and select Properties.
-
Under Select a page, select Options.
-
Change the settings of any and all properties to customize the index.
-
To add, remove, or change the position of an index column, select the General page from the Index Properties - index_name dialog box. For more information, see Index Properties F1 Help
-
In Object Explorer, connect to an instance of [!INCLUDEssDE].
-
On the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute.
USE AdventureWorks2012; GO SELECT i.name AS index_name, i.type_desc, i.is_unique, ds.type_desc AS filegroup_or_partition_scheme, ds.name AS filegroup_or_partition_scheme_name, i.ignore_dup_key, i.is_primary_key, i.is_unique_constraint, i.fill_factor, i.is_padded, i.is_disabled, i.allow_row_locks, i.allow_page_locks, i.has_filter, i.filter_definition FROM sys.indexes AS i INNER JOIN sys.data_spaces AS ds ON i.data_space_id = ds.data_space_id WHERE is_hypothetical = 0 AND i.index_id <> 0 AND i.object_id = OBJECT_ID('HumanResources.Employee'); GO
-
In Object Explorer, connect to an instance of [!INCLUDEssDE].
-
On the Standard bar, click New Query.
-
Copy and paste the following examples into the query window and click Execute.
[!code-sqlIndexDDL#AlterIndex4]
[!code-sqlIndexDDL#AlterIndex2]
For more information, see ALTER INDEX (Transact-SQL).