i have table "student" table , "evaluation" table refers "student", when tried delete data, it's ok, when try truncate it, failed message:
error 1701 (42000): cannot truncate table referenced in foreign key constraint (`testdb`.`evaluation`, constraint `fk_relationship_18` foreign key (`stu_id`) references `testdb`.`student` (`id`))
it shows same error when student table empty.. reason why happens? or should google how reset auto increment manually.
you cannot truncate table have fk constraint (just because truncate not same delete).
to resolve issue:
- remove constraints.
- perform truncate.
- delete manually rows have references "nowhere".
- create constraints.
Comments
Post a Comment