Dropping Constraint in SQL

sqlWe have seen in previous tutorials how to add constraints like FOREIGN KEY and DEFAULT.  But in case, you no longer need them, then you can easily drop them using DROP CONSTRAINT statement.  The syntax for dropping a constraint is given below.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ALTER TABLE {Table_Name}
DROP CONSTRAINT {Constraint_Name}
ALTER TABLE {Table_Name} DROP CONSTRAINT {Constraint_Name}
ALTER TABLE {Table_Name}
DROP CONSTRAINT {Constraint_Name}