SQL Server: The INSERT statement conflicted with the FOREIGN KEY constraint 'x'. (Msg 547)
The row references a parent that doesn’t exist (or a DELETE would orphan children).
Seen on:
SQL
Meaning
Msg 547 covers FK and CHECK conflicts for INSERT, UPDATE and DELETE. The message names the table and column.
Common causes
- Parent row missing
- Deleting a referenced parent
- CHECK constraint violation
⚡ Quick fix
- Insert parents first
- Delete or reassign children
- Use ON DELETE CASCADE where appropriate
Detailed fix by platform
SQL
SELECT * FROM dbo.Customers WHERE Id = 42;
How to diagnose
- Constraint — Which one and which column?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026