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
Asked
Active
Viewed 1,024 times
2

Martijn Pieters
- 1,048,767
- 296
- 4,058
- 3,343

Roshwin Lobo
- 21
- 2
-
1Please add the output from show create table details as text to the question. – P.Salmon Jun 03 '20 at 11:47
-
What's the error? – Honeyboy Wilson Jul 27 '20 at 22:48
3 Answers
1
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

blablabla
- 39
- 1
- 7
0
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;

Gaurav Chaudhari
- 1
- 2