Click here to Skip to main content
13,090,299 members (76,183 online)
Rate this:
Please Sign up or sign in to vote.
In My Table I Have Delete One Row from The Middle But Now I Want To Insert It At That Place Only.
In My Table There is Primary Key And It Is Autoincrement By 1
Please Help Me
Thanks In Advance
Posted 20-Feb-13 21:27pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You probably shouldn't try. You can do it by disabling the auto-increment while you do it and resetting the info, then doing the insert and putting the increment parameters back then re-enabling it, but it really isn't a good idea, because the advantage of an auto-increment is that it is all handled for you. If you do, then you had better do it in a stored procedure, because SQL is a multi-user system and if anyone tries to create a new record while you have auto-increment disabled you whole system will fall apart.

If you want to order the rows, then use your own ordering system instead of letting SQL handle it and specify where you want records - don't try to use the same system for two different and unrelated purposes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100