Re: why in procedure truncate table do not reset auto_increment?

2008-01-10 Thread Sebastian Mendel

x schrieb:

thanks

may you point out which chapter says?
 From manual I get the following answer agaist to my result(my server 
version 5.0.45),
For |InnoDB| before version 5.0.3, |TRUNCATE TABLE| is mapped to 
|DELETE|, so there is no difference. Starting with MySQL 5.0.3, fast 
|TRUNCATE TABLE| is available. However, the operation is still mapped to 
|DELETE| if there are foreign key constraints that reference the table. 
(When fast truncate is used, it resets any |AUTO_INCREMENT| counter. 
 From MySQL 5.0.13 on, the |AUTO_INCREMENT| counter is reset by 
|TRUNCATE TABLE|, regardless of whether there is a foreign key constraint.)


The table handler does not remember the last used |AUTO_INCREMENT| 
value, but starts counting from the beginning. This is true even for 
|MyISAM| and |InnoDB|, which normally do not reuse sequence values.


See:
http://dev.mysql.com/doc/refman/5.0/en/truncate.html 
http://dev.mysql.com/doc/refman/5.1/en/truncate.html


oh sorry, yes, i was confused, somehow i mixed some old behavior and InnoDB 
behavior ...


Martijn Tonies, sorry too

--
Sebastian

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread x

thanks

may you point out which chapter says?
From manual I get the following answer agaist to my result(my server 
version 5.0.45), 

For |InnoDB| before version 5.0.3, |TRUNCATE TABLE| is mapped to 
|DELETE|, so there is no difference. Starting with MySQL 5.0.3, fast 
|TRUNCATE TABLE| is available. However, the operation is still mapped to 
|DELETE| if there are foreign key constraints that reference the table. 
(When fast truncate is used, it resets any |AUTO_INCREMENT| counter. 
From MySQL 5.0.13 on, the |AUTO_INCREMENT| counter is reset by 
|TRUNCATE TABLE|, regardless of whether there is a foreign key constraint.)


The table handler does not remember the last used |AUTO_INCREMENT| 
value, but starts counting from the beginning. This is true even for 
|MyISAM| and |InnoDB|, which normally do not reuse sequence values.


See:
http://dev.mysql.com/doc/refman/5.0/en/truncate.html 
http://dev.mysql.com/doc/refman/5.1/en/truncate.html


Sebastian Mendel 写道:

过客 schrieb:
  

[...] why in procedure TRUNCATE table
demo do not reset auto_increment?



is clearly written in the documentation, just read ...

in short:

auto_increment is used for primary key, primary keys could be referenced
from another table, setting auto_increment back to 0 could lead to using a
primary key formerly used by another datarow and still referenced by another
table - could lead to data inconsistency.

  




Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb:
> 
>>>>>>> [...] why in procedure TRUNCATE table
>>>>>>> demo do not reset auto_increment?
>>>>>> is clearly written in the documentation, just read ...
>>>>>>
>>>>>> in short:
>>>>>>
>>>>>> auto_increment is used for primary key, primary keys could be
>>>>>> referenced
>>>>>> from another table, setting auto_increment back to 0 could lead to
>>>>>> using a
>>>>>> primary key formerly used by another datarow and still referenced by
>>>>>> another
>>>>>> table - could lead to data inconsistency.
>>>>> lol, but TRUNCATE empties the table... What good are your references?
>>>> it is better to have references leading to 'nothing' than to a wrong
>>>> datarow
>>>> ... i think this is very easy to understand - better save than sorry!
>>> Why is a row with an invalid reference better? It's invalid data and you
>>> just corrupted your database.
>> please define 'invalid' - i think invalid is it in booth cases, so an empty
>> invalid is better than a wrong invalid, or not?
> 
> IMO, you're f***ed in both cases :-)
> 
>> better have an unpayed bill leading to no costumer than to a wrong customer
> 
> Why is that better? If you TRUNCATEd the table, you know you're doing
> something wrong/your data is messed up.

yes, but this was not the point of the discussion

the point was why is auto_increment not reset - and the above is the reason
for this - i was not discussing if this is good or bad, or if it is good to
delete table content, or if the table content was deleted by accident


> As I said, what I wanted to point out is that this piece in the
> documentation is a bit strange.

yes, i have read it ... ;-)


-- 
Sebastian

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies


> >>>>> [...] why in procedure TRUNCATE table
> >>>>> demo do not reset auto_increment?
> >>>> is clearly written in the documentation, just read ...
> >>>>
> >>>> in short:
> >>>>
> >>>> auto_increment is used for primary key, primary keys could be
> >>>> referenced
> >>>> from another table, setting auto_increment back to 0 could lead to
> >>>> using a
> >>>> primary key formerly used by another datarow and still referenced by
> >>>> another
> >>>> table - could lead to data inconsistency.
> >>> lol, but TRUNCATE empties the table... What good are your references?
> >>
> >> it is better to have references leading to 'nothing' than to a wrong
> >> datarow
> >> ... i think this is very easy to understand - better save than sorry!
> >
> > Why is a row with an invalid reference better? It's invalid data and you
> > just corrupted your database.
>
> please define 'invalid' - i think invalid is it in booth cases, so an
empty
> invalid is better than a wrong invalid, or not?

IMO, you're f***ed in both cases :-)

> better have an unpayed bill leading to no costumer than to a wrong
customer

Why is that better? If you TRUNCATEd the table, you know you're doing
something wrong/your data is messed up.

As I said, what I wanted to point out is that this piece in the
documentation
is a bit strange.


Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb:
>>>>> [...] why in procedure TRUNCATE table
>>>>> demo do not reset auto_increment?
>>>> is clearly written in the documentation, just read ...
>>>>
>>>> in short:
>>>>
>>>> auto_increment is used for primary key, primary keys could be
>>>> referenced
>>>> from another table, setting auto_increment back to 0 could lead to
>>>> using a
>>>> primary key formerly used by another datarow and still referenced by
>>>> another
>>>> table - could lead to data inconsistency.
>>> lol, but TRUNCATE empties the table... What good are your references?
>> 
>> it is better to have references leading to 'nothing' than to a wrong
>> datarow
>> ... i think this is very easy to understand - better save than sorry!
> 
> Why is a row with an invalid reference better? It's invalid data and you
> just corrupted your database.

please define 'invalid' - i think invalid is it in booth cases, so an empty
invalid is better than a wrong invalid, or not?

better have an unpayed bill leading to no costumer than to a wrong customer



-- 
Sebastian

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies
> >>> [...] why in procedure TRUNCATE table
> >>> demo do not reset auto_increment?
> >> is clearly written in the documentation, just read ...
> >>
> >> in short:
> >>
> >> auto_increment is used for primary key, primary keys could be
referenced
> >> from another table, setting auto_increment back to 0 could lead to
using a
> >> primary key formerly used by another datarow and still referenced by
> > another
> >> table - could lead to data inconsistency.
> >
> > lol, but TRUNCATE empties the table... What good are your references?
:-)
>
> LOL ??? very funny, really
>
> why not read the manual before posting? could help me save a lot of time
...

You don't have to answer if you want to save time :-)

> only one table is truncated, not the one referencing to this one

I know that.

> it is better to have references leading to 'nothing' than to a wrong
datarow
> ... i think this is very easy to understand - better save than sorry!

Why is a row with an invalid reference better? It's invalid data and you
just
corrupted your database.

The point I'm trying to make is that this part of the documentation is a bit
strange, to say at least.

The only benefit I could thing of, is being able to re-fill the table with
the
original data, but then your auto-inc should be turned OFF in between the
mass INSERT and normal operations.



Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
Martijn Tonies schrieb:
>>> [...] why in procedure TRUNCATE table
>>> demo do not reset auto_increment?
>> is clearly written in the documentation, just read ...
>>
>> in short:
>>
>> auto_increment is used for primary key, primary keys could be referenced
>> from another table, setting auto_increment back to 0 could lead to using a
>> primary key formerly used by another datarow and still referenced by
> another
>> table - could lead to data inconsistency.
> 
> lol, but TRUNCATE empties the table... What good are your references? :-)

LOL ??? very funny, really

why not read the manual before posting? could help me save a lot of time ...

only one table is truncated, not the one referencing to this one

it is better to have references leading to 'nothing' than to a wrong datarow
... i think this is very easy to understand - better save than sorry!


-- 
Sebastian

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Martijn Tonies

> > [...] why in procedure TRUNCATE table
> > demo do not reset auto_increment?
>
> is clearly written in the documentation, just read ...
>
> in short:
>
> auto_increment is used for primary key, primary keys could be referenced
> from another table, setting auto_increment back to 0 could lead to using a
> primary key formerly used by another datarow and still referenced by
another
> table - could lead to data inconsistency.

lol, but TRUNCATE empties the table... What good are your references? :-)

Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: why in procedure truncate table do not reset auto_increment?

2008-01-09 Thread Sebastian Mendel
过客 schrieb:
> [...] why in procedure TRUNCATE table
> demo do not reset auto_increment?

is clearly written in the documentation, just read ...

in short:

auto_increment is used for primary key, primary keys could be referenced
from another table, setting auto_increment back to 0 could lead to using a
primary key formerly used by another datarow and still referenced by another
table - could lead to data inconsistency.

-- 
Sebastian

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



why in procedure truncate table do not reset auto_increment?

2008-01-06 Thread 过客
*hi everyone: *

I've some puzzle with the following test:

CREATE TABLE `demo` (
  `id` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
INSERT INTO demo VALUES(100);
delimiter //
create procedure test()
 DETERMINISTIC
begin
TRUNCATE table demo;
show table status like 'demo';
END//
delimiter ;

when call test() I got auto_increment=101, why in procedure TRUNCATE table
demo do not reset auto_increment?

any help much appreciate !


Re: reset auto_increment

2003-12-22 Thread Trevor Rhodes
Mike,

set insert_id=1;

> can the auto_increment value be reset back to '1' withou recreate the
> entire table again ?? The table would be emptied first, but we would like
> to reset the auto_increment value back to '1' without having to drop and
> recreate the table, if possible.

 Regards
  Trevor Rhodes
===
Powered by Linux- Mandrake 9.2
Registered Linux user # 290542 at http://counter.li.org
Registered Machine #'s 186951
Mandrake Club Silver Member
Source :  my 100 % Microsoft-free personal computer.
===
 10:13:58 up 17:21,  1 user,  load average: 1.42, 1.39, 1.22
-- 
Never mud wrestle with a pig.. you get dirty and the pig enjoys it!
Never try to teach a pig to dance. You waste your time and annoy the pig.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



reset auto_increment

2003-12-22 Thread Mike Blezien
Hi,

can the auto_increment value be reset back to '1' withou recreate the entire 
table again ?? The table would be emptied first, but we would like to reset the 
auto_increment value back to '1' without having to drop and recreate the table, 
if possible.

MySQL version 4.0.15 Linux

TIA

--
MikeBlezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Quality Web Hosting
http://www.justlightening.net
MSN: [EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


reset auto_increment

2003-01-11 Thread INVALID - TESTING ONLY. IF YOU GET EMAIL WITH THIS ACCOUNT PLEASE REPLY TO [EMAIL PROTECTED] INSTEAD. OBVIOUSLY WE MADE A MISTAKE IF YOU ARE READING THIS
I need to reset the auto_increment in a table full of data.  I had a problem
recently where some script was putting InvoiceID numbers into an
auto_increment CustID column...I since fixed the problem and corrected the
data but I now have a huge gap in my number sequence and I cant get
auto_increment reset to a more reasonable value.
 
Now I have read the archives and the online manual with user comments and
nothing has worked as of yet.
 
ALTER TABLE tbl_name AUTO_INCREMENT = 1
this command gives me a successful response but when I do a SHOW TABLE
STATUS the Auto_increment is still unchanged.
 
myisamchk -A=1 /path/to/db.MYI
this command also gives me a successful message but never changes the
auto_increment when displayed by SHOW TABLE STATUS
 
in section 3.5.9 of the MySQL manual with user comments I noted the
following comment on Oct 23 20002 by Ethan Pooley
http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html
He stated that the ALTER TABLE tbl_name AUTO_INCREMENT = 1 will only work
when the table is empty.
 
So what I need is the ability to reset the auto_increment without having to
empty the table first.  Or I need someone to help me figure out why the
above mentioned commands fail to do what everyone tells me they are suppose
to do.
 
-Jason


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: reset auto_increment

2003-01-11 Thread Paul DuBois
At 16:06 -0500 1/10/03, "INVALID - TESTING ONLY.  IF YOU GET EMAIL 
WITH THIS ACCOUNT P wrote:
I need to reset the auto_increment in a table full of data.  I had a problem
recently where some script was putting InvoiceID numbers into an
auto_increment CustID column...I since fixed the problem and corrected the
data but I now have a huge gap in my number sequence and I cant get
auto_increment reset to a more reasonable value.



Now I have read the archives and the online manual with user comments and
nothing has worked as of yet.


What is your table type?





ALTER TABLE tbl_name AUTO_INCREMENT = 1


Should work.



this command gives me a successful response but when I do a SHOW TABLE
STATUS the Auto_increment is still unchanged.


What value does it show, and what is the maximum value still in your
table?  If you expect this to set the next value *lower than the current
maximum value in the table*, it won't.  That's not how it works.





myisamchk -A=1 /path/to/db.MYI


-A=1 is invalid syntax.  Should be -A1 (no space) or
--set-auto-increment=1




this command also gives me a successful message but never changes the
auto_increment when displayed by SHOW TABLE STATUS



in section 3.5.9 of the MySQL manual with user comments I noted the
following comment on Oct 23 20002 by Ethan Pooley

http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html

He stated that the ALTER TABLE tbl_name AUTO_INCREMENT = 1 will only work
when the table is empty.


That's incorrect.




So what I need is the ability to reset the auto_increment without having to
empty the table first.  Or I need someone to help me figure out why the
above mentioned commands fail to do what everyone tells me they are suppose
to do.



-Jason



-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Reset auto_increment

2002-02-13 Thread Rick Emery

The following deletes all records and re-starts renumbering from 1;
DELETE FROM mytable;

The following deletes all records and continues counting from where the
table last left off:
DELETE FROM mytable WHERE 1;

If you are trying to restart numbering while not deleting records,
forget-about-it.
-Original Message-
From: Wei Gao [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: Reset auto_increment


Hi,
As I am new to MySQL, perhaps this is a common question you have been asked.

I have a field "Id" which using auto_increment. Now I want to reset the 
value of auto_increment, that is the "Id" starts form 1 and does not skip 
the number. I have spent a few hours to find a way, but all failed. Could 
you please tell me how to do it?

Wei

_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Reset auto_increment

2002-02-13 Thread Wei Gao

Hi,
As I am new to MySQL, perhaps this is a common question you have been asked. 
I have a field "Id" which using auto_increment. Now I want to reset the 
value of auto_increment, that is the "Id" starts form 1 and does not skip 
the number. I have spent a few hours to find a way, but all failed. Could 
you please tell me how to do it?

Wei

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Reset auto_increment

2002-02-07 Thread Paul DuBois

At 14:57 -0600 2/7/02, Rick Emery wrote:
>The following deletes all records and re-starts renumbering from 1;
>DELETE FROM mytable;
>
>The following deletes all records and continues counting from where the
>table last left off:
>DELETE FROM mytable WHERE 1;
>
>If you are trying to restart numbering while not deleting records,
>forget-about-it.

ALTER TABLE tbl_name
DROP id,
ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
AUTO_INCREMENT = 1;

But why do this?  MySQL doesn't care if the sequence has holes in
it or not.

>-Original Message-
>From: Wei Gao [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, February 07, 2002 2:10 PM
>To: [EMAIL PROTECTED]
>Subject: Reset auto_increment
>
>
>Hi,
>As I am new to MySQL, perhaps this is a common question you have been asked.
>
>I have a field "Id" which using auto_increment. Now I want to reset the
>value of auto_increment, that is the "Id" starts form 1 and does not skip
>the number. I have spent a few hours to find a way, but all failed. Could
>you please tell me how to do it?
>
>Wei


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Reset auto_increment

2002-02-07 Thread Rick Emery

The following deletes all records and re-starts renumbering from 1;
DELETE FROM mytable;

The following deletes all records and continues counting from where the
table last left off:
DELETE FROM mytable WHERE 1;

If you are trying to restart numbering while not deleting records,
forget-about-it.
-Original Message-
From: Wei Gao [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 07, 2002 2:10 PM
To: [EMAIL PROTECTED]
Subject: Reset auto_increment


Hi,
As I am new to MySQL, perhaps this is a common question you have been asked.

I have a field "Id" which using auto_increment. Now I want to reset the 
value of auto_increment, that is the "Id" starts form 1 and does not skip 
the number. I have spent a few hours to find a way, but all failed. Could 
you please tell me how to do it?

Wei

_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Reset auto_increment

2002-02-07 Thread Wei Gao

Hi,
As I am new to MySQL, perhaps this is a common question you have been asked. 
I have a field "Id" which using auto_increment. Now I want to reset the 
value of auto_increment, that is the "Id" starts form 1 and does not skip 
the number. I have spent a few hours to find a way, but all failed. Could 
you please tell me how to do it?

Wei

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: reset auto_increment?

2001-09-17 Thread Paul DuBois

At 3:15 PM -0400 9/17/01, Jay Fesco wrote:
>  >  Can someone tell me how to reset a column's auto_increment starting point
>>   back to 0 in mysql ?
>>
>>   Thanks
>>
>>   Paul
>>
>According to Paul DuBois on page 169 of MySQL by New Riders (which you
>should buy):
>
>ALTER TABLE t
> DROP i,
> ADD i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY
>
>Jay

Actually, this will drop the column and renumber the rows sequentially.

To just reset the sequence to 0 (well, to 1, since sequences start at 1),
do this:

ALTER TABLE t AUTO_INCREMENT = 1



-- 
Paul DuBois, [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: reset auto_increment?

2001-09-17 Thread Jay Fesco

>  Can someone tell me how to reset a column's auto_increment starting point
>  back to 0 in mysql ?
>
>  Thanks
>
>  Paul
>
According to Paul DuBois on page 169 of MySQL by New Riders (which you
should buy):

ALTER TABLE t
DROP i,
ADD i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY

Jay



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




reset auto_increment?

2001-09-17 Thread Paul Reilly


 Can someone tell me how to reset a column's auto_increment starting point
 back to 0 in mysql ?

 Thanks

 Paul




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php