For automatical autoincrement use AUTO_INCREMENT | IDENTITY
http://www.h2database.com/html/grammar.html#createtable
For manual autoincrement use DEFAULT and SEQUENCE
--
WBR, Yaroslav Kavenchuk.
Broken order.
file:///C:/JVM/H2/docs/html/grammar.html#createtable
create table numbers (ID int auto_increment primary key, Passcode
varchar(20) not null)
--
WBR, Yaroslav Kavenchuk.
This is supported in H2. See IDENTITY, Statement.getGeneratedKeys(),
and CALL IDENTITY().
> create table numbers (ID int primary key auto_increment, Passcode varchar(20) not null)
Unfortunately this is not supported at the moment. This should work however:
create table numbers (ID int auto_increment primary key, Passcode
varchar(20) not null)
I will add support for this special MySQL syntax in the next release.
Regards,
Thomas
> Syntax error in SQL statement
>
> CREATE TABLE IF NOT EXISTS COMPANY (
> CNAME VARCHAR(50) NOT NULL PRIMARY KEY,
> )[*] ; expected identifier; SQL statement:
There is an extra ',' just after 'PRIMARY KEY' and before ')'.
> CREATE TABLE IF NOT EXISTS company (
> cname varchar(50) NOT NULL primary key,
> ) [42001-64]
Here as well.
> I wonder if the semi colon I placed after each statement is causing
> the problem ?
No, the semicolon is required.
Regards,
Thomas