Insert value on an identity column of a SQL Server table

Insert value identity column SQL Server table

SET IDENTITY_INSERT dbo.Sampletable ON
Insert into dbo.Sampletable(a,b,c) values (1,2,3)  --> Here a is the identity column but values can be inserted after turning the Identity_insert ON. 
SET IDENTITY_INSERT dbo.Sampletable OFF

 

Insert value on an identity column of a SQL Server table was last modified: October 1st, 2017 by Justin Antony