Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Message-ID: <51C492E9.5000403@example.com> Date: Fri, 21 Jun 2013 19:52:41 +0200 From: Marc van Lieshout User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 Newsgroups: comp.lang.php To: richard Subject: Re: deleted primary key can't be reused? References: <1riuk3ca2113p$.1butqaatdq7hw.dlg@40tude.net> In-Reply-To: <1riuk3ca2113p$.1butqaatdq7hw.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Lines: 23 NNTP-Posting-Host: 2001:980:4910:1:b41c:34b9:569f:b21c X-Trace: 1371837159 news.xs4all.nl 15901 [2001:980:4910:1:b41c:34b9:569f:b21c]:4169 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:9854 On 08-06-13 16:24, richard wrote: > Entered 100 items into 2 columns each. > Deleted 2. > Upon entering new record using id of 98, no can do. > The next new record number becomes 101. > "Duplicate key error" is issued. > How do I take back the deleted key number so I can use it again? > No, I do not mean the data that is in the record. > To me, once a record is deleted, the key index should reflect that the > record no longer exists, so the key index should be -1 of what it was. > Not continue its esistance. > This is related to a problem I had once: I wanted a special record in a table with id 0. insert into (id, ...) values (0, ....); didn't work; the insert was succesful, but with ID 1. Then I executed: update
set id = 0 where id = 1; That solved the problem.