Hello everyone,
I am trying to change a field in a table in an embedded HSQLDB database, using SQL commands, to be the primary key and to change it to autovalue. The latter is giving me an error, which I cannot resolve.
DROP TABLE “emp” IF EXISTS;
CREATE TABLE “emp” (“id” INTEGER NOT NULL);
ALTER TABLE “emp” ALTER COLUMN “id” GENERATED BY DEFAULT AS IDENTITY
ALTER TABLE “emp” ADD PRIMARY KEY (“id”)
I have no problem creating the autovalue and primary key at the time of the table declaration, but when I try to do it later it gives me a wrong data type error.