auto number primary key - restarting

2003-07-15 Thread Miroslav I.
Hi, is there an SQL command for making a primary key (auto number key) to start numbering from beginning after deleting all the records from the table. thanks

Re: auto number primary key - restarting

2003-07-15 Thread Mojtaba Faridzad
delete all records by this command: TRUNCATE TABLE `mytable`; - Original Message - From: Miroslav I. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 8:10 AM Subject: auto number primary key - restarting Hi, is there an SQL command for making a primary key (auto

Re: auto number primary key - restarting

2003-07-15 Thread Victoria Reznichenko
Miroslav I. [EMAIL PROTECTED] wrote: is there an SQL command for making a primary key (auto number key) to start numbering from beginning after deleting all the records from the table. For MyISAM tables you can use ALTER TABLE: http://www.mysql.com/doc/en/ALTER_TABLE.html -- For

RE: auto number primary key - restarting

2003-07-15 Thread Rudy Metzger
Please check the history on this list. There are numerous answers to this problem. Cheers /rudy -Original Message- From: Miroslav I. [mailto:[EMAIL PROTECTED] Sent: dinsdag 15 juli 2003 14:10 To: [EMAIL PROTECTED] Subject: auto number primary key - restarting Hi, is there an SQL

Re: auto number primary key - restarting

2003-07-15 Thread Krasimir_Slaveykov
Hello Miroslav, Tuesday, July 15, 2003, 3:10:10 PM, you wrote: 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. MI Hi, MI is there an SQL command for making a primary key (auto number

Re: auto number primary key - restarting

2003-07-15 Thread Chris Boget
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;

RE: auto number primary key - restarting

2003-07-15 Thread Rudy Metzger
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

Re: auto number primary key - restarting

2003-07-15 Thread Chris Boget
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. Wow. Learn something new every day! :p Thanks for the tip, Rudy! Chris -- MySQL General Mailing List For list archives: