Article ID: 194522
Article Last Modified on 3/2/2005
Dim ServerObject As New SQLOLE.SQLServer
' Ensure the parameters on next line are passed in double quotation
' marks
ServerObject.Connect <servername>, <LoginID>, <Password>
Dim indexcolname As String
Dim idxcnt As Integer
Dim idxloops As Integer
Dim idxObj As SQLOLE.Index
Dim idxcol As SQLOLE.Column
idxcnt = 0
idxcnt = ServerObject.Databases("pubs").Tables("authors").Indexes(1). _
ListIndexedColumns.count
While idxcnt > 1
Set idxcol = ServerObject.Databases("pubs").Tables("authors"). _
Indexes(1).ListIndexedColumns(1)
indexcolname = idxcol.Name
MsgBox indexcolname
idxloops = 1
While idxloops < idxcnt
idxloops = idxloops + 1
Set idxcol = ServerObject.Databases("pubs").Tables("authors"). _
Indexes(1).ListIndexedColumns(idxloops)
indexcolname = idxcol.Name
MsgBox indexcolname
Wend
idxcnt = 0
Wend
Additional query words: prodsql DMO VB
Keywords: kbhowto kbinfo KB194522