RESTART_IDENTITY procedure

The RESTART_IDENTITY procedure examines the source-table and determines the identity column and its next value. The next value and column name are used to configure the target-table to use the same next value.

Authorization: The caller must have:
  • *EXECUTE authority on the library containing the table being modified, and
  • *OBJALTER authority on the table
Read syntax diagramSkip visual syntax diagramRESTART_IDENTITY( SOURCE_SYSTEM_TABLE_SCHEMA => source-schema,SOURCE_SYSTEM_TABLE_NAME => source-table,TARGET_SYSTEM_TABLE_SCHEMA => target-schema,TARGET_SYSTEM_TABLE_NAME => target-table )

The schema is QSYS2.

source-schema
A character or graphic string for the schema name containing source-file. It must be a system schema name.
source-table
A character or graphic string for the table name that has the identity value to copy. It must be a system table name. The table must contain an identity column.
target-schema
A character or graphic string for the schema name containing target-table. It must be a system schema name.
target-table
A character or graphic string for the table name that is to have its identity column value reset. It must be a system table name. The table must contain an identity column that has the same name as the identity column in source-table.

Example

Set the identity column in NEWTABLE to have the same next value as the identity column in OLDTABLE


CALL QSYS2.RESTART_IDENTITY(SOURCE_SYSTEM_TABLE_SCHEMA => 'OLDLIB',
                            SOURCE_SYSTEM_TABLE_NAME => 'OLDTABLE',
                            TARGET_SYSTEM_TABLE_SCHEMA => 'NEWLIB', 
                            TARGET_SYSTEM_TABLE_NAME => 'NEWTABLE')