Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
SQL-DMO Reference
Collections
 Indexes Collection

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
Other versions are also available for the following:
SQL Server 2008 Books Online (June 2009)
Indexes Collection

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

The Indexes collection contains Index objects that reference indexes that implement Microsoft SQL Server constraints and user-defined access paths.

SQL-DMO object model that shows the current object

With the Indexes collection, you can:

  • Create a user-defined access path or unique constraint on data maintained by a SQL Server index.
  • Remove a SQL Server index.

For more information about creating a SQL Server index using SQL-DMO, see Index Object.

To remove a SQL Server index:
  • Use the Remove method of the Indexes collection, as in:

    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)
ms141242.note(en-us,SQL.100).gifNote:
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.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker