DB2: Convert existing column to identity

Viewed 17571

I am attempting to convert an existing column to identity.

So far I am able to do so very easily with the following:

alter table list alter column id set generated always as identity (start with 0);

Unfortunately, I need it to start at the maximum number of the data that is already in the table.

I have tried the following but it complains of the subquery.

alter table list alter column id set generated always as identity (start with (select max(id) from list);

The subquery returns fine when ran alone.

1 Answers
Related