SQL Flow Field Guide

SET IDENTITY_INSERT

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

allows explicit values in the identity column of one table; changes INSERT lineage

What changes

Input
none
Output or change
session state

Syntax at a glance

SET IDENTITY_INSERT [ [ database_name . ] schema_name . ] table_name { ON | OFF }

Work example

A controlled data repair must supply explicit identity values for one named table.

Use a reviewed staging copy and ensure only one table has IDENTITY_INSERT enabled in the session. Turn it off in cleanup.

Check your work SET IDENTITY_INSERT. The required keys load once and IDENTITY_INSERT is off before the connection is reused.

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