14 Aralık 2015 Pazartesi

Mysql truncate foreign key constrained table

You can't TRUNCATE a table that has Foreign Key constraints applied on it (TRUNCATE is not the same as DELETE). If you want to do this action, following code will solve your problem.

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table1;
SET FOREIGN_KEY_CHECKS = 1;

Good luck!

Hiç yorum yok:

Yorum Gönder