SQL Foreign Key Constraint Error 1025 (152)

六眼飞鱼酱① 提交于 2019-12-12 12:24:23

问题


I keep getting an error every time i try to drop a table called "countires" and a field called "countries".

#1025 - Error on rename of '.\mutli_page_form\survey'
to '.\mutli_page_form\#sql2-820-1fb' (errno: 152)

It says there is a FK dependency on the table "survey" i have tried multiple times to delete it to no success.

#1217 - Cannot delete or update a parent row: a foreign key constraint fails

I now get this error once trying to delete the table of Countries


回答1:


The database has been told to ensure data integrity. This is what you're seeing. There is survey data that references a country. If you delete the country table then the survey data won't have valid countries associated with it. You'll have to remove the surveys first before you can remove the countries.




回答2:


You must set index both for id ()'s in 2 tables -> after try again



来源:https://stackoverflow.com/questions/5343406/sql-foreign-key-constraint-error-1025-152

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!