>>>>Hi,
>>>>
>>>>What is the syntax for dropping an index possibly used in a foreign key constraint? I have a table that has a unique index key. When I try to remove it using the following syntax:
>>>>
>>>>
>>>>use [MyDatabase]
>>>>drop index [IX_field_name] on TableName
>>>>
>>>>
>>>>I get message that
>>>>
>>>>An explicit DROP INDEX is not allowed on index 'TableName.IX_field_name'. It is being used for FOREIGN KEY
>>>>constraint enforcement.
>>>>
>>>>
>>>>I have removed all FK constraint on this field in other/child tables. So it must be something in this TableName. If not, how do I find out what foreign key is using this index key?
>>>>
>>>>TIA.
>>>
>>>Find the constraint name and use DROP CONSTRAINT command.
>>
>>How do you find the contraint? This table does not show this constraint in the Constraints branch.
>
>Run
>execute sp_help 'dbo.myTableName'
>
>to get information about everything related to this table. One of the result sets includes constraints.
This is very helpful. Thank you very much!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham