mod primary key field - newbie question
mod primary key field - newbie question
am 13.07.2009 23:35:46 von cool
--Apple-Mail-1-778290726
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
newbie question ... I have a MySQL table where I want to update
(renumber) the primary numeric key field.
- I successfully turned field off as a primary key index and UN auto
incremented it
- then created new sequential numbers for it
- then turned back on primary key index and re added auto increment in
BUT when I make a new record it does NOT start where new numbers stop
last is 51
next should be 52
but jumps to 157
Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how
do I fix this?
--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]
--Apple-Mail-1-778290726--
Re: mod primary key field - newbie question
am 13.07.2009 23:40:58 von Floyd Resler
Sounds like you want to set the auto increment. To do that, use this
query:
alter table `table_name` auto_increment 1;
That will reset it to one. Although I've never tried it, I assume you
can give it another value.
Take care,
Floyd
On Jul 13, 2009, at 5:35 PM, cool@hosting4days.com wrote:
> newbie question ... I have a MySQL table where I want to update
> (renumber) the primary numeric key field.
>
> - I successfully turned field off as a primary key index and UN auto
> incremented it
> - then created new sequential numbers for it
> - then turned back on primary key index and re added auto increment in
>
>
> BUT when I make a new record it does NOT start where new numbers stop
>
> last is 51
> next should be 52
>
> but jumps to 157
>
> Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how
> do I fix this?
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: mod primary key field - newbie question
am 14.07.2009 01:24:25 von Daniel Brown
On Mon, Jul 13, 2009 at 17:35,
cool@hosting4days.com wrote:
> newbie question ... I have a MySQL table where I want to update (renumber)
> the primary numeric key field.
The response you received from Floyd was accurate, but next time,
please keep these kinds of questions on the appropriate lists. This
wasn't on-topic or PHP-related, but instead should've been asked on
the MySQL list at mysql@lists.mysql.com.
--
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: mod primary key field - newbie question
am 14.07.2009 05:59:15 von HallMarc Websites
-----Original Message-----
From: Floyd Resler [mailto:fresler@adex-intl.com]
Sent: Monday, July 13, 2009 5:41 PM
To: cool@hosting4days.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] mod primary key field - newbie question
Sounds like you want to set the auto increment. To do that, use this
query:
alter table `table_name` auto_increment 1;
That will reset it to one. Although I've never tried it, I assume you
can give it another value.
Take care,
Floyd
On Jul 13, 2009, at 5:35 PM, cool@hosting4days.com wrote:
> newbie question ... I have a MySQL table where I want to update
> (renumber) the primary numeric key field.
>
> - I successfully turned field off as a primary key index and UN auto
> incremented it
> - then created new sequential numbers for it
> - then turned back on primary key index and re added auto increment in
>
>
> BUT when I make a new record it does NOT start where new numbers stop
>
> last is 51
> next should be 52
>
> but jumps to 157
>
> Q: is there a way to reset the NEXT SERIAL ID NUMBER somewhere? how
> do I fix this?
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists 09]
>
>
>
"alter table `table_name` auto_increment 1;"
Correct you can give it any value you wish it to start FROM. ie if you pass
51 as the value then the next will be Auto increment value will be 52
__________ Information from ESET Smart Security, version of virus signature
database 4240 (20090713) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php