The Indexes collection contains Index objects referencing indexes that implement Microsoft® SQL Server™ constraints and user-defined access paths.
With the Indexes collection, you can:
For more information about creating a SQL Server index using SQL-DMO, see Index Object.
To remove a SQL Server index:
oTables("Employees").Indexes.Remove("LastName")
When using the Item or Remove method, the Indexes collection supports member identification using either name or ordinal reference syntax. For example:
Set oIndex = oTable.Indexes("LastName")
Or:
Set oIndex = oTable.Indexes(2)
Note Creating or removing indexes by using the Indexes collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role db_ddladmin or a role with greater privilege.
Add Method | Refresh Method |
Item Method | Remove Method (Collections) |
ItemByID Method |