DB2 Auto-Increment Key Value Guide

In DB2, auto-increment primary keys are usually implemented using sequences. To view the current value of an auto-increment primary key, you can use the following SQL statement:

SELECT NEXTVAL FOR your_sequence_name FROM SYSIBM.SYSDUMMY1;

your_sequence_name is the name of the sequence you use to define an auto-increment primary key.

After executing the above SQL statement, it will return the value of the current auto-increment primary key.

bannerAds