4

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

Mohammed H
  • 6,880
  • 16
  • 81
  • 127
Xavier
  • 8,244
  • 18
  • 54
  • 85

2 Answers2

4

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.

Jay
  • 13,803
  • 4
  • 42
  • 69
  • the surveys data is 100% clean there are no records present – Xavier Mar 17 '11 at 18:31
  • ok i had to drop the whole table before i could do anything else thanks for your explanation it helped 100% ! – Xavier Mar 17 '11 at 18:37
  • 1
    @Xavier Just as a follow up. You could have kept the Survey table by just dropping the foreign key constraint to the countries table that you had on it. By dropping the survey table, it dropped the constraint also. So that works. – Jacob Schoen Mar 17 '11 at 18:47
1

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

Touki
  • 7,465
  • 3
  • 41
  • 63