Share via


Index Object

この機能は、将来のバージョンの Microsoft SQL Server では削除される予定です。新規の開発作業ではこの機能を使用しないようにし、現在この機能を使用しているアプリケーションは修正することを検討してください。

The Index object exposes the attributes of a single Microsoft SQL Server index.

現在のオブジェクトを表す SQL-DMO オブジェクト モデル

Properties

FileGroup Property

Name Property

FillFactor Property

NoRecompute Property

ID Property

SpaceUsed Property

IndexedColumns Property

StatisticsIndex Property

IsFullTextKey Property

Type Property (Index)

Methods

CheckIndex Method

RecalcSpaceUsage Method

EnumStatistics Method

Remove Method (Objects)

GenerateCreationSQL Method

Script Method

GenerateSQL Method (Index)

UpdateStatistics Method

ListIndexedColumns Method

UpdateStatisticsWith Method (Column, Index)

Rebuild Method

 

解説

A SQL Server index optimizes access to data in SQL Server tables. Indexes are also used to enforce some constraints, such as UNIQUE and PRIMARY KEY constraints.

With the Index object, you can:

  • Create a SQL Server index.
  • Create SQL Server data distribution statistics.
  • Remove a SQL Server index.
  • Remove SQL Server data distribution statistics.
  • Rebuild a SQL Server index.
  • Update data distribution statistics.

The Name property of an Index object uses the SQL Server data type sysname. Within a SQL Server database, all index names must be unique.

To create a SQL Server index

  1. Create an Index object.

  2. Set the Name property.

  3. Set the IndexedColumns property to the column or columns participating in the index.

  4. Set the Type property of the Index object to control the attributes of the index created (optional). If this property is not set, a non-clustered index allowing duplicate values is created. For more information about SQL Server index types and limitations on indexes applied to tables, see CREATE INDEX (Transact-SQL).

  5. Set optional properties, such as FileGroup.

  6. Get the Table object that references the SQL Server table you want from the Tables collection of a connected Database object.

  7. Use the BeginAlter method of the Table object to mark the start of changes to the SQL Server table.

  8. Add the Index object to the Indexes collection of the selected Table object.

  9. Use the DoAlter method of the Table object to mark the end of changes and create the index on the SQL Server.

To remove an existing SQL Server index

  1. Get the Table object that references the SQL Server table you want from the Tables collection of a connected Database object.

  2. Use the BeginAlter method of the Table object to mark the start of changes to the SQL Server table.

  3. Get the Index object representing the SQL Server index to remove from the Indexes collection of the selected Table object.

  4. Use the Remove method of the Index object to remove the Index object from the Indexes collection of the Table object.

  5. Use the DoAlter method of the Table object to mark the end of changes and remove the SQL Server index from the SQL Server table.

ms143081.note(ja-jp,SQL.90).gifメモ :
The Index object is compatible with instances of SQL Server versions 7.0 and later. However, the Index2 object extends the functionality of the Index object for use with features that were introduced in SQL Server 2000.

参照

関連項目

Index2 Object

ヘルプおよび情報

SQL Server 2005 の参考資料の入手