SET IDENTITY_INSERT
Allows explicit values to be inserted into the identity column of a table.
Syntax
SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON OFF }
Arguments
database
Is the name of the database in which the specified table resides.
owner
Is the name of the table owner.
table
Is the name of a table with an identity column.
Remarks
At any time, 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, Microsoft® SQL Server™ returns an error message that states SET IDENTITY_INSERT is already ON and reports the table it is set ON for.
If the value inserted is larger than the current identity value for the table, SQL Server automatically uses the new inserted value as the current identity value.
The setting of SET IDENTITY_INSERT is set at execute or run time and not at parse time.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment