setting auto_increment value with a local variable
am 19.03.2010 13:21:09 von sureshkumarilu--000e0cd32f9edf536a04822661a4
Content-Type: text/plain; charset=ISO-8859-1
Hi,
Is there any way to set the auto_increment value with the variable like
below.
mysql> set @id=10;
mysql> alter table suresh_copy auto_increment=@id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to use
near '@id' at line 1
It is working and below but need to work ab above.
mysql> alter table suresh_copy auto_increment=1000;
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
From the MySQL documentation :
------------------------------
To change the value of the AUTO_INCREMENT counter to be used for new rows,
do this:
ALTER TABLE t2 AUTO_INCREMENT = value;
You cannot reset the counter to a value less than or equal to any that have
already been used.
Thanks
Suresh Kuna
--000e0cd32f9edf536a04822661a4--