On Mon, 3 Oct 2011, Reindl Harald wrote:

I have questions regarding how MyISAM handles auto_increment clolumn?

it is a table-property and you hould NOT touch it without godd reasons
because it is named AUTO

I guess there are quite often good reasons to change it, which can be
done e.g. as

alter table north33b  auto_increment=200001;

I often generate an empty table with the same structure as another table with a statement like :

create table xxxx select * from yyyy limit 0;

(at this point I have to recreate also all indices etc. doing a show create table xxxx and show create table yyyy and alter table yyyy for anything which is missing)

The new table yyyy will have auto increment starting where xxxx ended. This is good (assuming xxxx will not grow any more) to preserve an UNIQUE sequence for all tables different for each table.

In case one wants yyyy to start at a "round number" one can just issue an alter table and reset auto_increment.

The same if one tests some procedure to populate a new table yyyy, then deletes everything, and wants that production population restarts from 1.

--
------------------------------------------------------------------------
Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
------------------------------------------------------------------------
Citizens entrusted of public functions have the duty to accomplish them
with discipline and honour
                          [Art. 54 Constitution of the Italian Republic]
------------------------------------------------------------------------
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html
------------------------------------------------------------------------

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to