Archive

Archive for December, 2014

Truncate foreign key constrained table

December 10, 2014 Leave a comment

SET FOREIGN_KEY_CHECKS = 0;

TRUNCATE table1;
TRUNCATE table2;

SET FOREIGN_KEY_CHECKS = 1;

With these statements, you risk letting in rows into your tables that do not adhere to the FOREIGN KEY constraints.

Categories: Techanical