A constraint is untrusted when is_not_trusted = 1 in sys.foreign_keys or sys.check_constraints. It happens when it is created WITH NOCHECK, or re-enabled with ALTER TABLE ... CHECK CONSTRAINT (which defaults to WITH NOCHECK), typically after a bulk load or a migration that disabled constraints.
Effects: new writes are still checked, but existing rows were never validated, so orphans or invalid values may already be there and reports or joins can return wrong results. The optimiser cannot rely on it, so it loses join elimination and contradiction detection.
Fix: find the violating rows (e.g. LEFT JOIN to the parent where it is NULL), delete, correct or re-parent them, then run ALTER TABLE t WITH CHECK CHECK CONSTRAINT c. It scans the table under a schema lock, so schedule it off-peak on large tables.
Checks knowledge of WITH NOCHECK and the optimiser's use of trusted constraints.
Last updated 23 Nov 2026.