Subject Arg.. Autonum generator newbie question...
Author cowmix3
I have looked at every example and I can't get things to work.. Here
is what I have for my example:

CREATE TABLE "ITEMS"
(
"ITEMNUM" INTEGER NOT NULL,
"CATEGORYNUM" INTEGER,
PRIMARY KEY ("ITEMNUM")
);




CREATE GENERATOR ITEMNUM_ID;
COMMIT;
SET TERM;

CREATE TRIGGER ITEM_ID_TRIG FOR ITEMS

BEFORE INSERT POSITION 0
AS BEGIN
ITEMS.ITEMNUM = GEN_ID(ITEMNUM_ID, 1);
END

SET TERM ;

And I get something like this:

ISC ERROR CODE:335544351

ISC ERROR MESSAGE:
unsuccessful metadata update
DEFINE GENERATOR failed
attempt to store duplicate value (visible to active transactions) in

unique index "RDB$INDEX_11"

Arg!

Help!

<march>