SQL Flow Field Guide

DBCC CHECKCONSTRAINTS

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

DBCC CHECKCONSTRAINTS: administrative check or maintenance

What changes

Input
database, table, index, cache or server state named in the command
Output or change
messages or result sets; maintenance forms change storage, caches or metadata

Syntax at a glance

DBCC CHECKCONSTRAINTS [ ( table_name | table_id | constraint_name | constraint_id ) ] [ WITH [ { ALL_CONSTRAINTS | ALL_ERRORMSGS } ] [ , ] [ NO_INFOMSGS ] ]

Work example

A data review needs to find rows that violate enabled constraints.

Scope the check to the affected table or constraint and retain the returned key values.

Check your work No violating rows remain or every returned key has a tracked correction.

Open Microsoft Learn for full syntax, permissions, and details for your version.