Truncate table mysql with foreign key
You cannot truncate/empty the table which has foreign key constraints applied on it
Use the below query to empty the table with foreign key but at your own risk.
Note : Please take backup of database first.
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE tablename1;
TRUNCATE tablename2;
SET FOREIGN_KEY_CHECKS = 1;
No comments:
Post a Comment