SQL Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF

SET IDENTITY_INSERT Table_Name ON;
GO

    /* Do your Inserts */

SET IDENTITY_INSERT Table_Name OFF;
GO

Note

Not a good practice, not advised at all. You may very well end up having duplicate values so let the identity column generate the values for you. if you want to be able to insert the values yourself then do not make it an identity column at all.

If you are explicitly inserting values in an Identity column, to make sure you never end up with duplicate values, you can reseed the identity column value after you have explicitly inserted values:

DBCC CHECKIDENT ('Table_Name', RESEED, 0); --<-- Reseed value to 0
GO

DBCC CHECKIDENT ('Table_Name', RESEED);    --<-- Reseed value to next available value
GO