Can anyone give me the command to remove the check constraint in workbench please? I used alter table details drop check details_chk_1; but it isnt working. It shows error in drop command. pls help
Can anyone give me the command to remove the check constraint in workbench please? I used alter table details drop check details_chk_1; but it isnt working. It shows error in drop command. pls help
This is working in my workbench 8.0
alter table TABLE_NAME drop check CHECK_NAME;
The name can be found by running any command on the column. For eg: I ran
alter table movies rename column Release_Year to Year ;
which gave me this error
18:03:57 alter table movies rename column Release_Year to Year Error Code: 3959. Check constraint 'movies_chk_1' uses column 'Release_Year', hence column cannot be dropped or renamed. 0.000 sec
From here you can use the name of the constraint and paste it to resolve the error. Here's the resolved response
18:04:14 alter table movies drop check movies_chk_1 0 row(s) affected Records: 0 Duplicates: 0 Warnings: 0 0.203 sec
18:10:17 alter table movies rename column Release_Year to Year 0 row(s) affected Records: 0 Duplicates: 0 Warnings: 0 0.047 sec
ALTER TABLE student DROP CONSTRAINT constraint_name;
you can set constraint name manually also ... but if you want to check constraint name which is auto set.. .then enter following query show create table table_name;