Prblem With Inserting Data With Identity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinci
    New Member
    • Aug 2006
    • 62

    Prblem With Inserting Data With Identity

    Greetings!

    I Have A Little Problem...

    Is It Possible To Make The Identity In My Table Reset?
    I Have Used The Table Already To Make Insert Some Sample Data.. Now I Deleted Those Data Inserted.. The Problem Now Is That The Identity Goes On With Incrementing(ob viously)...

    For Example:

    I Have 2 Columns And 3 Rows..
    1st Col Is The Identity, 2nd Is Some Data...
    The Rows Has Identities Which Are 1,2,3 Respectively..
    Then I Manually Deleted The 3rd Row Which Has The ' 3 ' Value In The First Col... Now When I Inserted Data, The Value Becomes ' 4 ' In The First Col, Becuase Obvioulsy It Is An Identity Column..

    My Question Is, Is It Possible To Still Have The ' 3 ' Value When I Insert A New Value?

    Or Maybe Just Reset The Table To Start With The Last Identity In The Table... Just Like With My Example...
    (some Scripts Maybe?)
  • mabubakarpk
    New Member
    • Feb 2007
    • 62

    #2
    Follow the steps
    1. Drop Identity Column from table and Save
    2. Re Create Identity Column.

    Hope fully your problem will be resolve.

    Regards

    Comment

    • pumo21
      New Member
      • Nov 2007
      • 1

      #3
      [QUOTE=vinci]Greetings!

      I Have A Little Problem...

      Is It Possible To Make The Identity In My Table Reset?
      I Have Used The Table Already To Make Insert Some Sample Data.. Now I Deleted Those Data Inserted.. The Problem Now Is That The Identity Goes On With Incrementing(ob viously)...


      You can use this:

      SET IDENTITY_INSERT TableName ON

      and then attempt to insert with an identity number that has been deleted.

      Comment

      Working...