Hi, I'd like to use an identity-column And I am not quite sure how to receive the used number, if I used default. Actually I need the particular identity-value for the entries of other tables, since they are supposed to reference it. Am I forced to give those identities for my own like with a sequence-number, or can I somwhow get it by some "magic" statement? -------------------------------- here my particular case: CREATE TABLE "APP"."INPUTFILES" ( INPUTFILE_ID int generated always as identity ,"NAME" VARCHAR(512) NOT NULL ,"TMPST_IN" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); CREATE TABLE "APP"."OUTPUTFILES" ( OUTPUTFILE_ID int generated always as identity ,INPUTFILE_ID int ,"NAME" VARCHAR(512) NOT NULL ,"TMPST_IN" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ); ALTER TABLE "APP"."INPUTFILES" ADD CONSTRAINT "PK_INPUTFILE_ID" PRIMARY KEY ("INPUTFILE_ID"); ALTER TABLE "APP"."OUTPUTFILES" ADD CONSTRAINT "PK_OUTPUTFILE_ID" PRIMARY KEY ("OUTPUTFILE_ID");
ALTER TABLE "APP"."OUTPUTFILES" ADD CONSTRAINT "FK_INPUTFILE_ID" FOREIGN KEY ("INPUTFILE_ID") REFERENCES "APP"."INPUTFILES" ("INPUTFILE_ID") ON DELETE CASCADE ON UPDATE RESTRICT; --------------- Am I right that I need to use generated by default as identity instead of int generated always as identity And that there is no way to get the identity value if generated by derby? Malte Kempff