Question: drop check constraint when constraint name is not known

Question

drop check constraint when constraint name is not known

Answers 1
Added at 2016-12-25 15:12
Tags
Question

Is it possible to delete check constraint(no constraint name declared) that is created within CREATE TABLE command?

Answers to

drop check constraint when constraint name is not known

nr: #1 dodano: 2016-12-25 15:12

Run the below query to find the list of check constraints in your table, including what they are checking for:

select constraint_name, search_condition
from user_constraints 
where table_name = 'Your table name'
and constraint_type = 'C' -- To filter Check constraints alone

Copy the name of the relevant constraint and paste it in the Alter table drop constraint command.

Alter Table Your_table_name 
       Drop Constraint constraint_name; -- Replace constraint_name from above query result
Source Show
◀ Wstecz