Hi Fraenk
Gibt es eine Möglichkeit, den Wert von auto_increment, nach dem Löschen des letzten Datensatzes auf 1 zurückzusetzen, ohne die Tabelle zu löschen und wieder neu anzulegen bzw. zu kopieren?
Ausschnitt aus http://www.mysql.com/doc/A/L/ALTER_TABLE.html
An integer column may have the additional attribute AUTO_INCREMENT. When you insert a value of NULL (recommended) or 0 into an AUTO_INCREMENT column, the column is set to value+1, where
value is the largest value for the column currently in the table. AUTO_INCREMENT sequences begin with 1. See section 8.4.3.126 mysql_insert_id(). If you delete the row containing the maximum
value for an AUTO_INCREMENT column, the value will be reused with an ISAM, or BDB table but not with a MyISAM or InnoDB table. If you delete all rows in the table with DELETE FROM table_name
(without a WHERE) in AUTOCOMMIT mode, the sequence starts over for all table types. Note: there can be only one AUTO_INCREMENT column per table, and it must be indexed. MySQL Version 3.23 will
also only work properly if the AUTO_INCREMENT column only has positive values. Inserting a negative number is regarded as inserting a very large positive number. This is done to avoid precision problems
when numbers 'wrap' over from positive to negative and also to ensure that one doesn't accidentally get an AUTO_INCREMENT column that contains 0. In MyISAM and BDB tables you can specify
AUTO_INCREMENT secondary column in a multi-column key. See section 3.5.9 Using AUTO_INCREMENT. To make MySQL compatible with some ODBC applications, you can find the last inserted row
with the following query: SELECT * FROM tbl_name WHERE auto_col IS NULL
Das heisst, alle Records löschen reicht damit es wieder bei 1 anfängt.
Gruss Daniela