mysql删除主键重复ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key con
2018-03-16 09:28
701 查看
若一个table 中的某个column是其他table的foreign key,那么,该table不能使用truncate\drop。
执行以下语句可以执行成功
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE tableName;
SET FOREIGN_KEY_CHECKS=1;
执行以下语句可以执行成功
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE tableName;
SET FOREIGN_KEY_CHECKS=1;
相关文章推荐
- ERROR 1701 (42000): Cannot truncate a table referenced in a foreign key constraint
- Mysql删除表提示Cannot truncate a table referenced in a foreign key constraint解决办法
- mysql Error : Cannot truncate a table referenced in a foreign key constraint 清空具有外键约束的表时报
- Mysql Reference Constraint -ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
- mysql删除有外链索引数据,Cannot delete or update a parent row: a foreign key constraint fails 问题的解决办法
- ERROR:duplicate key in table MYsql
- MySQL:ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
- MySQL:ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
- MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key co
- MySQL添加外键时报错 ERROR 1215 (HY000): Cannot add foreign key constraint
- MySQL删除表:Cannot delete or update a parent row: a foreign key constraint fails。
- 1451, 'Cannot delete or update a parent row: a foreign key constraint fails.MYsql执行删除时报错。
- linux系统mysql删除一行报错:Cannot delete or update a parent row: a foreign key constraint fails
- 【mysql】【报错】Mysql外键名重复的错误:duplicate key in table '#sql-*'
- sql删除多个字段重复数据有主键和没主键解决方法(mysql)
- MySql建表时出错ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that correspond
- EJB3: Mapping of 1-to-1 relationships when primary key in the source table is also a foreign key for the target entity
- mysql无法添加外键约束(cannot add foreign key constraint)
- 醉了,mysql的删除居然变得这么麻烦 delete from table where id in()
- 数据库删除重复属性列,错误[HY000][1093] You can't specify target table 'orders' for update in FROM clause