IDENTITY_INSERT

  • Comments posted to this topic are about the item IDENTITY_INSERT

  • I think that the answer “You cannot set IDENTITY_INSERT on for more than one table in a database” should be changed to You cannot set IDENTITY_INSERT on for more than one table at the same time in a SESSION.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Adi Cohn (1/26/2009)


    I think that the answer “You cannot set IDENTITY_INSERT on for more than one table in a database” should be changed to You cannot set IDENTITY_INSERT on for more than one table at the same time in a SESSION.

    Adi

    To clarify further I would think

    You cannot set IDENTITY_INSERT on for more than one table AT A TIME in a SESSION.

    🙂

  • You want to correct a problem with two of your tables with keys created by identity values.

    Personally I think this implies that there is erroneous data to be removed before an insert.

    Inserting without deleting will simply add data without rectifying the problem. (generalisation)

  • Does anybody else but me think that Order_details is designed wrongly? OrderID should be a foreign key to Orders.OrderID. The natural key of Order_Details is OrderID and LineItemID which does not require an IDENTITY column at all.;)

  • hmmm, over-think question we are. IDENTITY_INSERT is the heart of the question, not design of the tables.

  • Correcting the question now. good points about the session.

  • Adi Cohn (1/26/2009)


    I think that the answer “You cannot set IDENTITY_INSERT on for more than one table in a database” should be changed to You cannot set IDENTITY_INSERT on for more than one table at the same time in a SESSION.

    Adi

    true. very misleading

  • nice basic question 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Thanks Dear,

    It is really a good question for developers...

    Thanks,
    Shiva N
    Database Consultant

Viewing 10 posts - 1 through 9 (of 9 total)

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