Locked History Actions

HowToTurnOffIdentityColumn

The script below is an SQL Server snippet that demonstrates how to turn on and off a database table's identity column so that you can specdify what value you'd like to use for a key rather than have the database generate one for you as is the case when a table has the identty flag set on a table column. One can do this through SQL Server Management Studio GUI but using this script is much faster.

SET IDENTITY_INSERT SomeTableName ON

INSERT INTO SomeTableName(!SomePKColumn, SomeOtherColumn, etc...) VALUES (79, value2, etc..)

SET IDENTITY_INSERT SomeTableName OFF


CategorySqlServer