SQL Flow Field Guide

INSERT

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

maps source columns to target columns positionally or by column list; defaults, identity, computed columns filled implicitly

What changes

Input
VALUES rows, a SELECT, EXECUTE result sets, DEFAULT VALUES, or nested DML OUTPUT
Output or change
rows in one target table or view (or table variable)

Syntax at a glance

[ WITH <common_table_expression> [ ,...n ] ] INSERT { [ TOP ( expression ) [ PERCENT ] ] [ INTO ] { <object> | rowset_function_limited [ WITH ( <Table_Hint_Limited> [ ...n ] ) ] } { [ ( column_list ) ] [ <OUTPUT Clause> ] { VALUES ( { DEFAULT | NULL | expression } [ ,...n ] ) [ ,...n ] | derived_table | execute_statement | <dml_table_source> | DEFAULT VALUES } } } [;]

Work example

A new row must be added to the target with its required columns made visible in the statement.

Run the sample against its table variable. Name the target columns and check constraints, defaults, and duplicate keys before using a real table.

Check your work INSERT. Two rows appear in @Scores with the stated values. No permanent table changes.

Practice SQL

Open in SQL Flow
DECLARE @Scores TABLE (Id int, Points int);
INSERT @Scores (Id, Points) VALUES (1, 12), (2, 18);
SELECT Id, Points FROM @Scores ORDER BY Id;

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