var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: IDENTITY column in typed table?
I am trying to get a generated identity column in a typed table.
According to SQL ref I can specify any <column-options> in the WITH OPTIONS clause. That would include the <generated-column-spec>
Thats what I am doing:
CREATE TYPE library.test_t AS (
) MODE DB2SQL;
CREATE TABLE library.test2 OF library.test_t (
id WITH OPTIONS GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL PRIMARY KEY,
When I try to create the table that way, it says something like "GENERATED" is followed by an unexpected token
"ALWAYS AS IDENTITY (START WITH".
Where is my mistake?
Or is it simply not possible to use IDENTITY columns with typed tables?
Copied the wrong (and definitely not working CREATE TABLE statement). That should do better:
CREATE TABLE library.test OF library.test_t (
REF IS OID user generated,
id WITH OPTIONS NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY
That one works if I leave out tge generated-part.
The fact that I have to supply my own OID or use those workarounds recommended in the docs is another minor issue.