RE: [PHP] Newbie SET AUTO_INCREMENT question
| From: | Jack Dempsey | Date: | Fri, 18 Apr 2003 17:46:05 +0000 |
| Subject: | RE: [PHP] Newbie SET AUTO_INCREMENT question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144421@lists.php.net to get a copy of this message | ||
Hey Verdon,
Just a suggestion--although some people on this list might be able to help,
I think you'll have a better chance posting that to the mysql list, as its
really not about PHP. this lets us focus on the php questions people might
have...
as for your question, i believe you're correct, and you should try something
with alter...check mysql.com as you've done for details and e-mail their
list...
all the best,
jack
> -----Original Message-----
> From: Verdon Vaillancourt [mailto:vern@verdon.ca]
> Sent: Friday, April 18, 2003 12:50 PM
> To: 'PHP-General'
> Subject: [PHP] Newbie SET AUTO_INCREMENT question
>
>
> Hi :)
>
> I have some data that each week needs to be moved to an archive
> and deleted
> from the original. Archived data is also recycled each week. I mostly have
> the process working and it flows like the following...
>
> // empty a pair of tables (archives data)
> DELETE FROM
listingsDB_archive
> DELETE FROM listingsDBElements_archive
>
> // copy the contents from a pair of similar tables (current data)
> // to the recently emptied tables (archives data)
> INSERT INTO listingsDB_archive SELECT * FROM
> listingsDB
> INSERT INTO listingsDBElements_archive SELECT * FROM
> listingsDBElements
>
> // empty the similar tables(current data)
> DELETE FROM listingsDB
> DELETE FROM listingsDBElements
>
> This works fine except the auto incrementing 'ID' field in
> listingsDB (the
> autoindex field) is reset to 0 each time. I need to NOT have the autoindex
> reset, but instead to have it keep running uninterrupted. Some reading at
> mysql.com makes me think I can do something like the following, but I'm
> stuck...
>
> ALTER listingsDB SET AUTO_INCREMENT=xx or
> ALTER listingsDB SET INSERT_ID=xx
>
> Actually, I know I would need to somehow find and store the correct value
> for AUTO_INCREMENT before I delete from listingsDB and then
> restore it.
>
> I'm just wondering, am I going in the right direction or am I
> barking up the
> wrong tree?
>
> TIA, verdon
> PS please cc me in any replies to list.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>