You can use DB2 sequence to automatically generate a primary key. The following describes how to use DB2 sequence to automatically generate a primary key. If you are interested in this, take a look.
Write a tracing program to record the operations performed on the data.
It is assumed that Access has an automatic number type, which can automatically generate a primary key for the field.
After checking db2, I feel that using DB2 Sequence is a bit like this.
-- Create a DB2 Sequence to generate an id
Create sequence xixi. id_log
AS bigint
Start with 1
Increment by 1
NO MAXVALUE
CYCLE
No cache;
Detailed difference description see ibm description http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/admin/r0004201.htm? Resultof = % 22% 73% 65% 71% 75% 65% 6e % 63% 65% 22% 20)
-- Query the previous id
Values prevval for xixi. id_log;
-- Generate id
Values nextval for xixi. id_log;
-- Insert record
Insert into xixi. id_log (id) values
(Nextval for xixi. id_log)
-- Delete sequence
Drop sequence userid. ID_PDALOG restrict
It is convenient to automatically generate a primary key without using max.
However, it is a pity that the table is not defined as Access.
How to Create a tablespace in DB2
Introduction to the DB2 user group in Linux
Top 10 considerations for DB2 Performance Optimization
Connect SQL SERVER to the DB2 database
DB2 index types