错误信息如下:
Mysql error 1452 - Cannot add or update a child row: a foreign key constraint fails
这有可能是现在正在使用的约束限制你修改。
可以先禁用约束检查
mysql> SET foreign_key_checks = 0;
mysql> alter table tblUsedDestination add constraint f_operatorId foreign key(iOperatorId) references tblOperators (iOperatorId); Query
OK, 8 rows affected (0.23 sec) Records: 8 Duplicates: 0 Warnings: 0
启用约束检查
mysql> SET foreign_key_checks = 1;