In this blog post, let’s learn about the error message “1597 The maximum of the IDENTITY column, col-name, for the table, table-name, could not be obtained.” when working with HPE NonStop SQL/MX, the reason for the error and the solution to fix this error message.
Error Message
1597 The maximum of the IDENTITY column, col-name, for the table, table-name, could not be obtained.
Reason for the Error
The maximum value of the IDENTITY column cannot be obtained from the table.
Solution
Resubmit the statement. If it fails, manually obtain the maximum value of the IDENTITY column. Increment this value by using the INCREMENT BY option value for the IDENTITY column.
If the IDENTITY column default specification type is GENERATED BY DEFAULT, recalibrate the CURRENT_VALUE of the internal sequence generator using the following command:
ALTER TABLE table-name ALTER COLUMN column-name RECALIBRATE TO value NO SELECT
Where,
table-name is the table that contains the IDENTITY column;
column-name is the IDENTITY column name;
value is the CURRENT_VALUE of the IDENTITY column.
If the IDENTITY column default specification type is GENERATED ALWAYS AS IDENTITY, recalibrate the CURRENT_VALUE of the internal sequence generator using the ALTER TABLE ALTER COLUMN SET INCREMENT BY manual calibration instructions