IDENTITY_INSERT

  • How to set IDENTITY_INSERT to ON for table AAA.

  • SET IDENTITY_INSERT aaa ON

    ....straight from BOL!

  • set identity_insert aaa on

    insert into mytab(id, name) values (1,'fred')

    insert into mytab(id, name) values (2,'sam')

    insert into mytab(id,name) select custid, name from customer

    set identity_insert aaa off

    1) You need to specify the column names when inserting into an identity column

    2) Don't forget to turn the identity_insert back off.

    Robert F Knopf


    Robert F Knopf

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

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