SQL Flow Field Guide

ALTER TABLE column_constraint

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

changes a column, constraint or column property

What changes

Input
table definition
Output or change
column or constraint definition

Syntax at a glance

[ CONSTRAINT constraint_name ] { [ NULL | NOT NULL ] { PRIMARY KEY | UNIQUE } [ CLUSTERED | NONCLUSTERED ] [ WITH FILLFACTOR = fillfactor ] [ WITH ( index_option [, ...n ] ) ] [ ON { partition_scheme_name (partition_column_name) | filegroup | "default" } ] | [ FOREIGN KEY ] REFERENCES [ schema_name . ] referenced_table_name [ ( ref_column ) ] [ ON DELETE { NO ACTION | CASCADE | SET NULL | SET DEFAULT } ] [ ON ...

Work example

A column constraint needs a reviewed default, check, key, or reference rule.

Test existing rows and future insert values against the proposed constraint in a lab.

Check your work Valid rows pass and one deliberately invalid test row is rejected.

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