Frage

I'm unable to delete record from sqlite db using Navicat. The error reads: `Error constraint failed'

I get the same thing if I try to delete with the console using an sql command:

sqlite> delete from myTable where sort = '965';
constraint failed
sqlite> 

any idea why this might be happening.

thanks for the help

War es hilfreich?

Lösung

It looks like this table has a Field which is referenced as a FK in another table, so the SQlite saying

"I can,'t delete it, its inuse in another table"

Andere Tipps

Use the .schema command of the sqlite3 shell to show all table definitions. Then you can see which constraint on myTable or a child table blocks you from deleting.

If there is a foreign key constraint in another table, you have to delete all records in that table that reference your 965 record before you can delete the record itself.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top