Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

SET IDENTITY_INSERT

Description

Applies or removes the IDENTITY_INSERT property to the specified table.

Syntax

SET IDENTITY_INSERT tablename { ON | OFF }

Arguments

  • tablename - The name of a table with an identity column.

Notes:

Only one table in a session can have the IDENTITY_INSERT property set to ON. If a table already has this property set to ON, and a SET IDENTITY_INSERT ON statement is issued for another table, an error will be returned.

If the value inserted is larger than the current identity value for the table, the server uses the new inserted value as the current identity value.

The setting of SET IDENTITY_INSERT is applied at execute time, not at parse time.

Permissions

User must own the table or have ALTER permission on the table.

TOCIndex