Coba:
CREATE TABLE `test_table` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=1;
SET @`tmpvar` := 12345;
SET @`stmt_alter` := CONCAT('ALTER TABLE `test_table` AUTO_INCREMENT = ', @`tmpvar`);
PREPARE `stmt` FROM @`stmt_alter`;
EXECUTE `stmt`;
DEALLOCATE PREPARE `stmt`;
PERBARUI
Anda dapat menggunakan 13,5 Sintaks SQL untuk Pernyataan yang Disiapkan untuk 13.1.14 CREATE TABLE Syntax .
SET @`tmpvar` := 12345;
SET @`stmt_create` := CONCAT('CREATE TABLE `test_table` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=', @`tmpvar`);
PREPARE `stmt` FROM @`stmt_create`;
EXECUTE `stmt`;
DEALLOCATE PREPARE `stmt`;