a foreign key constraint fails

In SQL Server, if you got a problem while deleting a rows with error:

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

The simple way to do is:

SET FOREIGN_KEY_CHECKS=0;

Don’t forget to set it back again after deleting rows.

SET FOREIGN_KEY_CHECKS=1;