For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2007 > Re: [PHP-DB] auto_increment command









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] auto_increment command
bedul

2007-03-11, 9:58 pm

u can't
----- Original Message -----
From: "Ron Piggott" <ron.php@actsministries.org>
To: "PHP DB" <php-db@lists.php.net>
Sent: Monday, March 12, 2007 7:52 AM
Subject: [PHP-DB] auto_increment command


> I am not sure if that last e-mail went through or not. I am wondering
> how to re-set the auto_increment field back to 1 in one of my tables.
> Ron


there no such thing reset auto_increment
if you need the reset.. there were way to do that.
rename the table.. then take query to build it
create new table and tralalla.. u have reset it.

fyi. if inside the table already have a data were id was 100.. the next id
must be 101..
btw.. if you want to make your table more clean (i said about.. how random
the num).. there is a way.
what reason u wanna do that??
Micah Stevens

2007-03-12, 3:59 am

Actually you can. As Bastien pointed out:

ALTER TABLE tbl AUTO_INCREMENT = 1;

This may screw with your indexes though, if you have a primary indexed,
or unique indexed row, and you set this to 1, mysql >>MAY<< try and
insert conflicting values. I've never done this so I have no idea how
this is handled by the server, but I suspect you'll just get an error.

-Micah

On 03/11/2007 06:55 PM, bedul wrote:
> u can't
> ----- Original Message -----
> From: "Ron Piggott" <ron.php@actsministries.org>
> To: "PHP DB" <php-db@lists.php.net>
> Sent: Monday, March 12, 2007 7:52 AM
> Subject: [PHP-DB] auto_increment command
>
>
>
>
> there no such thing reset auto_increment
> if you need the reset.. there were way to do that.
> rename the table.. then take query to build it
> create new table and tralalla.. u have reset it.
>
> fyi. if inside the table already have a data were id was 100.. the next id
> must be 101..
> btw.. if you want to make your table more clean (i said about.. how random
> the num).. there is a way.
> what reason u wanna do that??
>
>


Persephone

2007-03-13, 10:13 pm

Carmen Electra Giving A Head And Taking A Load!
http://Carmen-Electra-Giving-A-Head...hp?movie=148803
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com