SQL Flow Field Guide

ALTER TABLE table_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 ] { { PRIMARY KEY | UNIQUE } [ CLUSTERED | NONCLUSTERED ] (column [ ASC | DESC ] [ ,...n ] ) [ WITH FILLFACTOR = fillfactor ] [ WITH ( <index_option>[ , ...n ] ) ] [ ON { partition_scheme_name ( partition_column_name ... ) | filegroup | "default" } ] | FOREIGN KEY ( column [ ,...n ] ) REFERENCES referenced_table_name [ ( ref_column [ ,...n ] ) ] [ ON DELETE { NO ACTION | CASCADE | SET ...

Work example

A table-level primary key, unique, check, or foreign key rule needs a change.

Find duplicate, invalid, or orphaned lab rows before enabling the revised constraint.

Check your work Existing rows pass validation and the rule blocks the matching invalid test case.

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