Home Forums SQL Server 2005 T-SQL (SS2K5) Insert records into a table with an identity value RE: Insert records into a table with an identity value

  • Do not use SET IDENTITY INSERT ON – that is telling SQL Server that you wish to override the auto-increment for some reason. So given a table X

    Id int identity (1,1,) primary key,

    Desc varchar(100)

    insert X (Desc)

    select Desc from table

    You will see that the Identity column is not mentioned in the above – it takes care of itself.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.