DB2命令小计


//
创建一个sequence
CREATE SEQUENCE business_SEQ
AS bigint
START WITH 1
INCREMENT BY 1
NO MAXVALUE
CYCLE
CACHE 20;
//使用序列号sequence
next value FOR BUSINESS_SEQ
//插入记录
INSERT INTO BUSINESS
(BUSINESSID,CREATEDATE,UPDATED)
VALUES(next value FOR BUSINESS_SEQ,CURRENT TIMESTAMP,CURRENT TIMESTAMP);
在数据库中查询,可以使用:VALUES NEXTVAL FOR BUSINESS_SEQ;

你可能感兴趣的:(db2)