InletDownload

SQL Server error 547

The INSERT statement conflicted with the CHECK constraint

The row you inserted or updated makes a CHECK constraint’s condition false, so SQL Server refused the whole statement. Read the constraint’s definition, then fix the value, or the rule if the rule is wrong.

The INSERT statement conflicted with the CHECK constraint "CK_products_price". The conflict occurred in database "inlet", table "seo_sqlerr_data.products", column 'price'.

Tested on SQL Server 2022 RTM-CU27 (16.0.4295.3); same messages on 2019 RTM-CU32-GDR and 2025 RTM-CU9 · Updated 9 October 2026

What it means

A CHECK constraint is a condition every row must meet, such as price > 0 or ends >= starts. Your INSERT or UPDATE produced a row for which the condition is false, so SQL Server stopped the statement (all of its rows, not only the bad one) with error 547.

The message names the constraint, the table and, for a constraint on one column, the column:

The INSERT statement conflicted with the CHECK constraint "CK_products_price". The conflict occurred in database "inlet", table "seo_sqlerr_data.products", column 'price'.

It doesn’t show the value or the condition. A constraint over several columns names no column at all. The same number, 547, is used for foreign keys; here the message says CHECK constraint.

A condition that comes out NULL (unknown) passes: CHECK (price > 0) accepts a NULL price. Use NOT NULL on the column as well if the value is required.

Common causes

  1. A value outside the rule: a zero or negative price, a quantity that an update takes below zero, an end date before the start date, a status that isn’t in the allowed list.
  2. Application rules out of step with the database: the app allows a new status ('archived') that the constraint’s IN (…) list doesn’t.
  3. An update that applies to many rows, where one row goes out of range (SET qty = qty - 6).
  4. Adding a constraint to existing data that already breaks it. The message then reads The ALTER TABLE statement conflicted with the CHECK constraint ….
  5. A constraint you didn’t name. CHECK (qty >= 0) written inline gets a generated name such as CK__products__qty__32AB8735, which differs on every server and tells you little until you look it up.

How to fix it

Read the constraint

SELECT name, definition, is_not_trusted, is_disabled
FROM sys.check_constraints
WHERE parent_object_id = OBJECT_ID('dbo.products');

On the test table below (sqlcmd -W):

name definition is_not_trusted is_disabled
---- ---------- -------------- -----------
CK_products_price ([price]>(0)) 0 0
CK__products__qty__32AB8735 ([qty]>=(0)) 0 0
CK_products_dates ([ends]>=[starts]) 0 0

Compare the definition with the row you sent. For an UPDATE, work out the new value: qty - 6 on a row with qty = 5 is -1.

Fix the data

Correct the value in your statement, or clean up the rows before adding a constraint. To find the rows that would fail, select those where the condition is false:

SELECT id, qty FROM dbo.products WHERE NOT (qty <= 3);

Change the rule, if the rule is wrong

A constraint can’t be altered in place: drop it and add the new version, in one transaction so the table is never unprotected. Give it a name so the next error is readable:

BEGIN TRAN;
ALTER TABLE dbo.orders DROP CONSTRAINT CK_orders_status;
ALTER TABLE dbo.orders ADD CONSTRAINT CK_orders_status
  CHECK (status IN ('new', 'paid', 'shipped', 'archived'));
COMMIT;

Check constraints added WITH NOCHECK

ALTER TABLE … WITH NOCHECK ADD CONSTRAINT … adds a constraint without checking existing rows. New writes are checked; old rows that break it stay, and the constraint is marked not trusted. To list the rows that break the constraints on a table, without changing anything:

DBCC CHECKCONSTRAINTS ('dbo.products');
Table Constraint Where
----- ---------- -----
[seo_sqlerr_data].[products] [CK_products_qty_max] [qty] = '5'

After fixing them, ALTER TABLE dbo.products WITH CHECK CHECK CONSTRAINT CK_products_qty_max; checks every row and marks it trusted again.

Reproduce it

On SQL Server 2022 (16.0.4295.3) with sqlcmd, in a scratch schema:

CREATE TABLE seo_sqlerr_data.products (
  id int NOT NULL PRIMARY KEY,
  price decimal(10,2) NULL CONSTRAINT CK_products_price CHECK (price > 0),
  qty int NOT NULL CHECK (qty >= 0),
  starts date NOT NULL,
  ends date NOT NULL,
  CONSTRAINT CK_products_dates CHECK (ends >= starts)
);
INSERT INTO seo_sqlerr_data.products VALUES (1, 9.99, 5, '2026-01-01', '2026-12-31');

INSERT INTO seo_sqlerr_data.products VALUES (2, 0, 5, '2026-01-01', '2026-12-31');
UPDATE seo_sqlerr_data.products SET qty = qty - 6 WHERE id = 1;
INSERT INTO seo_sqlerr_data.products VALUES (3, 5, 1, '2026-06-01', '2026-05-01');
Msg 547, Level 16, State 1, Server 7732422b7f56, Line 1
The INSERT statement conflicted with the CHECK constraint "CK_products_price". The conflict occurred in database "inlet", table "seo_sqlerr_data.products", column 'price'.
The statement has been terminated.
Msg 547, Level 16, State 1, Server 7732422b7f56, Line 1
The UPDATE statement conflicted with the CHECK constraint "CK__products__qty__32AB8735". The conflict occurred in database "inlet", table "seo_sqlerr_data.products", column 'qty'.
The statement has been terminated.
Msg 547, Level 16, State 1, Server 7732422b7f56, Line 1
The INSERT statement conflicted with the CHECK constraint "CK_products_dates". The conflict occurred in database "inlet", table "seo_sqlerr_data.products".
The statement has been terminated.

A row with a NULL price went in. Adding CHECK (qty <= 3) while row 1 had a quantity of 5:

Msg 547, Level 16, State 1, Server 7732422b7f56, Line 1
The ALTER TABLE statement conflicted with the CHECK constraint "CK_products_qty_max". The conflict occurred in database "inlet", table "seo_sqlerr_data.products", column 'qty'.

Added WITH NOCHECK instead, it went in, and DBCC CHECKCONSTRAINTS listed that row as above. SQL Server 2019 and 2025 printed the same messages; only the generated name differed (CK__products__qty__123EB7A3 on 2019, CK__products__qty__3864608B on 2025).

In Inlet

When SQL Server refuses, Inlet shows its message with SQL Server error 547, state 1, severity 16 and links to this page. A table’s definition shows its CREATE TABLE with its constraints, so you can read the condition without querying sys.check_constraints. Grid edits are staged until you commit (⌘S), and Review shows what will run first.

Related

Sources