In my previous articles I explained about Check Constraint creation at the Table Level and also at the Column Level.
How to query Check Constraints Definition?
The below script will give you Constraint definition along with the constraint name.
SELECT TC.TABLE_NAME,CC.CONSTRAINT_NAME,CC.CHECK_CLAUSE
FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS CC,
INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC
WHERE TC.TABLE_NAME = 'ACCOUNT'
AND TC.CONSTRAINT_TYPE = 'CHECK'
AND TC.CONSTRAINT_NAME = CC.CONSTRAINT_NAME

How to Drop Check Constraints?
As always to drop any object you need to find out the object name. In this case ,I want to drop cc_max_bal constraint defined on a table.
ALTER TABLE ACCOUNT DROP CONSTRAINT cc_max_bal;
That’s it. It’s very simple.
Are you looking for anything else in this!!!!
No comments:
Post a Comment