You got to be kidding! I am sure there's a better solution.

Hassan


----- Original Message -----
From: "Tobias Asplund" <[EMAIL PROTECTED]>
To: "Hassan Shaikh" <[EMAIL PROTECTED]>
Cc: <
Sent: Monday, January 12, 2004 9:43 PM
Subject: Re: Resetting Auto_Increment


> On Mon, 12 Jan 2004, Hassan Shaikh wrote:
>
> > Hi,
> > The following does not work for InnoDB tables. The manual says
"The next AUTO_INCREMENT value you want to set for your table
(MyISAM). "
> > ALTER TABLE <table_name> AUTO_INCREMENT = <new_value>;
> >
> > Any suggestions for InnoDB?
>
> Insert a row with a custom value, then delete it, the next value
insrted
> will be value+1 of the value you juse inserted.
>
> Example below:
>
> [EMAIL PROTECTED]:tmp > CREATE TABLE ai (num INT UNSIGNED NOT NULL
AUTO_INCREMENT PRIMARy KEY) TYPE=INNODB;
> Query OK, 0 rows affected (0.01 sec)
>
> [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES (NULL), (NULL), (NULL);
> Query OK, 3 rows affected (0.02 sec)
> Records: 3  Duplicates: 0  Warnings: 0
>
> [EMAIL PROTECTED]:tmp > SELECT * FROM ai;
> +-----+
> | num |
> +-----+
> |   1 |
> |   2 |
> |   3 |
> +-----+
> 3 rows in set (0.00 sec)
>
> [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES(10);
> Query OK, 1 row affected (0.00 sec)
>
> [EMAIL PROTECTED]:tmp > DELETE FROM ai WHERE num=10;
> Query OK, 1 row affected (0.01 sec)
>
> [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES(NULL);
> Query OK, 1 row affected (0.00 sec)
>
> [EMAIL PROTECTED]:tmp > SELECT * FROM ai;
> +-----+
> | num |
> +-----+
> |   1 |
> |   2 |
> |   3 |
> |  11 |
> +-----+
> 4 rows in set (0.00 sec)
>
> [EMAIL PROTECTED]:tmp > \t
>
>
>
>
> ---
> avast! Antivirus: Inbound message clean.
> Virus Database (VPS): 1/8/2004
> Tested on: 1/12/2004 11:26:18 PM
> avast! is copyright (c) 2000-2003 ALWIL Software.
> http://www.avast.com
>
>
>
>


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

Reply via email to