truncate table_name

does both in one statement. And even optimizes the table (frees up
unused disk space). However take care that you cannot rollback this DDL.

Cheers
/rudy

-----Original Message-----
From: Chris Boget [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 15 juli 2003 15:29
To: Krasimir_Slaveykov; Miroslav I.; [EMAIL PROTECTED]
Subject: Re: auto number primary key - restarting

> Easiest way to do what you want is to make this:
> 1.SHOW CREATE TABLE TableName
> and copy SQL
> 2. DROP TABLE TableName
> 3. CREATE TABLE - with SQL copied in 1.

Actually, the easiest way to do this (assuming *all*
records have been deleted) is:

UPDATE table_name SET auto_increment_field = 0;

Replace '0' with any number that you want to start with.

Chris


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


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

Reply via email to