> Creating a table with an identity column works fine
> create table test(a integer, id integer generated always as identity )
[quoted text clipped - 11 lines]
> Expected
> tokens may include: "<left_paren>". SQLSTATE=42601
It's a two step process:
alter table test2 add column id integer not null with default 0;
alter table test2 alter column id set generated always as identity;
The reason is that DB2 needs to know what to do with the existing rows.
In the case above all your existing rows get the value 0.
If you wish you can now run:
UPDATE TEST2 SET id = DEFAULT;
This will generate identity values for each row and you can add a unique
index afterwards.
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
DB2 UDB for Linux, Unix, Windows
IBM Toronto Lab