I have a DB2 table with an id
column that has an auto increment, here's the code:
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1)
I manually inserted values that already have id
values and do not begin with 1.
Now when I add records to this table, it begins at 1. I would like to begin when my records end., i.e. say the latest record has id 23, I would like the new record to have id = 24.
Is there a way I can do this on all my tables with minimum effort?
Based on @mustaccio comment, the most straightforward to achieve it is:
ALTER TABLE "tableName" ALTER COLUMN "columnName" RESTART WITH <new index value>