Total Pageviews

Saturday 17 March 2012

Id Auto Increment in Java DB

Using Database Table grab structure  can get the following:

create table "APP".EMPLOYER
(
 ID INTEGER default AUTOINCREMENT: start 1 increment 1 not null primary key,
 NAME VARCHAR(256)
);

but  this can never be run in the SQL command window
To fix the problem, change the above to the following:

CREATE TABLE "APP"."EMPLOYER"
("ID" INT not null primary key         GENERATED ALWAYS AS IDENTITY         (START WITH 1, INCREMENT BY 1),  
"NAME" VARCHAR(256));

No comments:

Post a Comment