September 8, 2010 at 5:45 am
hi i am generating primary key with identity 10 and i am incrementing by 10.Unfortunatly the order takes place like 10,50,60.so now i want to place them in order like 10,20,30.please help me.
seshu
September 8, 2010 at 5:48 am
seshireddy524 (9/8/2010)
hi i am generating primary key with identity 10 and i am incrementing by 10.Unfortunatly the order takes place like 10,50,60.so now i want to place them in order like 10,20,30.please help me.
seshu
Funny! How can you tell that the "order is incorrect?"
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 8, 2010 at 6:38 am
Have you maybe tried to insert the 2nd record and failed to do so because a non-nullable column was left unspecified or an fk-condition was not met? If the insert is rolled back, the identity value assigned will not be returned. i.e. even though the inserts of the records that originally got assigned the values 20, 30 and 40 were rolled back, the counter of the 'last assigned identity value' was left at 40 after 3 failed attempts. Thus the next record inserted got assigned the value of 50.
September 8, 2010 at 6:47 am
remove primary key and auto increment value.
Rest them to 10 20 30 and assign back the primary key and auto increment
----------
Ashish
September 8, 2010 at 7:18 am
Why are you worrying about GAPs when using identity column?
Failing to plan is Planning to fail
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply