Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying a Constraint vs. Index using the SqlDmo Object

Status
Not open for further replies.

Ambsgirl

Programmer
Dec 5, 2006
13
US
I have a program that tries to alter various columns which means of course, I have to drop indexes and/or constraints on that column. I was looping through the indexes on the table and doing it that way but many of those indexes in that collection are constraints and I was getting an error stating that an explicit drop index is not allowed on that index because it is being used for a constraint. I discovered that anytime an index was marked as a constraint under the unique section in Enterprise Manager, it's actually a constraint. However, I do not see any way in SqlDmo to distinguish between the two. Here's the code I was using:
for each oIndex as sqldmo.index in otable.indexes
strQuery="DROP index " & otable.name & "." & oindex.name
next
So my question is, how do I know if an index is a constraint using the sqldmo object?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top