How to remove a SQL Server constraint

0

I'm having a problem removing a constraint from a table.

Purpose is to exclude the constraint to delete a table.

The problem is: I have a Yield table that is associated with Extra Yield. This Yield table is FK_COD_RENDA_EXTRA.

ALTER TABLE PERFORMANCE_EXTRA DROP CONSTRAINT [COD_RENDA_EXTRA]

but returns the error message

"Message 3728, Level 16, State 1, Line 2 'COD_RENDA_EXTRA' is not a constraint. Message 3727, Level 16, State 0, Line 2 Unable to cancel restriction. Please refer to the above errors. "

    
asked by anonymous 26.12.2017 / 18:13

1 answer

2

So I understand your constraint is [FK_COD_RENDA_EXTRA] in the Income table. Change the constraint name and table to perform the drop correctly, as this has to be done in the table that contains the FK.

ALTER TABLE [Rendimento] DROP CONSTRAINT [FK_COD_RENDA_EXTRA]
    
26.12.2017 / 18:20