insert into identity column with out identity insert

  • Hi Experts,

    I am trying to export /add  table rows (table1) to another table (table2) . Table2 has an identity column , is there any approach that table1 rows can be transferred to table2 with out using identity insert ?
    PS: Identity column is a primary key.

  • If you want to specify the values for the identity column, you need to set IDENTITY_INSERT on for that table. If you want the identity to automatically assign the values, then you can insert without setting that on.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks for the reply.

    Realized that using non-identity column list in insert into statement will make identity column to auto increment.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply