简体   繁体   中英

how to do “adc” INTEGER GENERATED BY DEFAULT IDENTITY in .sql file: adc is coloumn name

how to do adc INTEGER GENERATED BY DEFAULT IDENTITY in .sql file. adc is my coloumn name. i want this beacuse i am using tag in spring which takes a script of schema which is of .sql extension. but my embedded database is in hsql. hsql does not support autoincrement so i have to write the create table statement in my .sql file like this :

CREATE TABLE personal (
    id INTEGER GENERATED BY DEFAULT IDENTITY,
    username varchar(45) NOT NULL,
    password varchar(45) NOT NULL,
    host_name varchar(45) DEFAULT NULL,
    port_number varchar(45) DEFAULT NULL,
    database_name varchar(45) DEFAULT NULL
)

how i can do the above query in .sql file. please help me as soon as possible Thank you

Your statement needs the addition of "AS" to the IDENTITY definition:

CREATE TABLE personal ( id INTEGER GENERATED BY DEFAULT AS IDENTITY, username varchar(45) NOT NULL, password varchar(45) NOT NULL, host_name varchar(45) DEFAULT NULL, port_number varchar(45) DEFAULT NULL, database_name varchar(45) DEFAULT NULL )

As another user said in the comment, please go to your previous questions and "accept" the correct answers. If you do not do this, people will not answer your future questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM