auto increment ID in H2 database

前端 未结 5 1661
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 01:57

Is there a way to have an auto_incrementing BIGINT ID for a table. It can be defined like so

id bigint auto_increment

but that has no effec

5条回答
  •  我在风中等你
    2020-12-24 02:17

    It works for me. JDBC URL: jdbc:h2:~/temp/test2

    drop table test;
    create table test(id bigint auto_increment, name varchar(255));
    insert into test(name) values('hello');
    insert into test(name) values('world');
    select * from test; 
    

    result:

    ID  NAME  
    1   hello
    2   world
    

提交回复
热议问题