When we try to insert some explicit data into an IDENTITY column the following error occurred.
Create Table test1 ( Id Int Identity(1,1), Id2 int ) Go Set identity_insert test1 on Insert test1 (Id,Id2) values(Null,1) Set identity_insert test1 off
Error is: Msg 339, Level 16, State 1, Line 3 DEFAULT or NULL are not allowed as explicit identity values.
Published under: SQL Server Tips · · · ·
Also refer this post http://beyondrelational.com/blogs/madhivanan/archive/2011/02/09/can-an-identity-column-be-nullable.aspx