{
  "id": 19619442,
  "title": "SQL Server Multiple Cascade Paths (Error 1785): Which Foreign Key Loses ON DELETE CASCADE, and What Replaces It",
  "url": "https://urgent.news/2026/11/12/sql-server-multiple-cascade-paths-error-1785-which-foreign-key-loses",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-12T07:48:30.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/tbson87/sql-server-multiple-cascade-paths-error-1785-which-foreign-key-loses-on-delete-cascade-and-what-55an"
  },
  "original_language": "en",
  "account": "SQL Server Error 1785 occurs when a foreign key constraint with CASCADE would create multiple paths to the same table, causing a cycle. This prevents the creation of the foreign key constraint. To resolve this issue, one of the foreign keys must be set to NO ACTION, meaning that the DELETE operation will fail with error 547 instead of cascading. The other foreign key should be replaced with a stored procedure or an INSTEAD OF DELETE trigger on the parent table. This allows the deletion to be handled properly, and the cascade action to proceed as intended. In the given example, the comments.user_id foreign key is set to NO ACTION, while the post.user_id foreign key is replaced with a stored procedure to handle the deletion.",
  "summary": "Disclosure: I build Schemity , a desktop ERD tool - this post is from our blog and uses it for the examples. TL;DR: SQL Server refuses a foreign key when its CASCADE , SET NULL or SET DEFAULT would let one delete or update reach the same table by two paths, and it decides that from the declared actions when the key is created, not from the rows. One key has to become NO ACTION , which makes some…",
  "key_points": [
    "SQL Server Error 1785 prevents foreign key cascade due to multiple paths",
    "Set one foreign key to NO ACTION to stop cascade deletion",
    "Replace the other foreign key with stored procedure or trigger"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}