Giving Value for Identity column while inserting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sajithamol

    Giving Value for Identity column while inserting

    I have a table with an Identity column. The latest Identity value is 1298. A row with Identity 324 was deleted by mistake and I need to insert it now. But if I insert it now it will have Identity value of 1299. I tried giving the value 324 for the Identity column in the Insert statement but it throws error. How can I insert this row with the same Identity value as before??
  • devikacs
    New Member
    • Jun 2007
    • 96

    #2
    Originally posted by sajithamol
    I have a table with an Identity column. The latest Identity value is 1298. A row with Identity 324 was deleted by mistake and I need to insert it now. But if I insert it now it will have Identity value of 1299. I tried giving the value 324 for the Identity column in the Insert statement but it throws error. How can I insert this row with the same Identity value as before??
    Are you not able to insert using a plain insert statement on query analyser?

    Comment

    • leela mn
      New Member
      • May 2007
      • 43

      #3
      You can do this by
      SET IDENTITY_INSERT [table_name] ON
      and then turn it off

      Comment

      Working...