SQL Flow Field Guide

CREATE TABLE ... GENERATED ALWAYS AS

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

system-generated period or ledger column

What changes

Input
engine state at write time
Output or change
generated column definition

Syntax at a glance

column_name datatype GENERATED ALWAYS AS { ROW | TRANSACTION_ID | SEQUENCE_NUMBER } { START | END } [ HIDDEN ] [ NOT NULL ]

Work example

A ledger or temporal design needs database-generated transaction or row sequence values.

Map each generated column to the audit query and confirm application writes never supply its value.

Check your work The engine fills the generated values and the query can order rows by the documented pair.

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