Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    55

    Unanswered: identity field and IDENTITY_INSERT is Off

    ok, so i get this error,
    Code:
    Exception Details: System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'TBL_LAPTOP_BOOKINGS' when IDENTITY_INSERT is set to OFF.
    i ran
    Code:
    SET INDENTITY_INSERT TBL_LAPTOP_BOOKINGS ON
    before i ran my script... and i also checked, we are running SQL 2000 with service pack four, because of the cursor error....

    so im just wondering, is there anyway to make identity_insert to always be on, or any other way to have a unique id in my booking_id field??

    Thanks Guys, Justin

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Just to clarify: did you SET IDENTITY_INSERT YourTable ON in the same connection as the one where you attempted the insert?

    I'm not certain that you always want IDENTITY_INSERT set to ON.

    Regards,

    hmscott
    Have you hugged your backup today?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •