Delete a constraint using the SSMS database management tool
1, connect the database, select data Table-"Expand Key or Constraint-" Select the constraint to delete-"Right click-" SELECT Delete.
2. In the Delete object popup box-"click OK."
3, refresh the table-"Expand the Key or constraint-" view the results.
To delete a constraint using a T-SQL script
Grammar:
--Declaring database usage
Use database name;
Go
--Determine if a constraint exists, delete if it exists, do not delete if it does not exist
if exists (select * from sysobjects where name= constraint name)
ALTER TABLE name DROP CONSTRAINT constraint name;
Go
Example:
--Declaring database usage
Use TESTSS;
Go
--Determine if a constraint exists, delete if it exists, do not delete if it does not exist
if exists (select * from sysobjects where name= ' default1 ')
ALTER TABLE test1 drop constraint default1;
Go
Delete Constraint Summary
The deletion operation is irreversible, in the production database, regardless of whether the constraints are useful, you need to be careful to delete, the correct operation is to first backup and then delete.
SQL Server Delete constraint