DB2建表实例-语句


CREATE TABLE "DB2ADMIN".T_XLGZGL_TYPE (
  ID	VARCHAR(32)	NOT NULL  GENERATED BY DEFAULT
    AS IDENTITY (START WITH 1, INCREMENT BY 1, CACHE 20,
       NO MINVALUE, NO MAXVALUE, NO CYCLE, NO ORDER),
  LXMC	VARCHAR(32),
  XLLXMS	VARCHAR(100),
  CJZID	VARCHAR(32),
  CJSJ	TIMESTAMP,
  CJZSSBMID	VARCHAR(32),
  GXZID	VARCHAR(32),
  GXSJ	TIMESTAMP,
  GXZSSBMID	VARCHAR(32)
);

ALTER TABLE "DB2ADMIN".T_XLGZGL_TYPE
  DATA CAPTURE NONE
  PCTFREE 0
  LOCKSIZE ROW
  APPEND OFF
  NOT VOLATILE;

COMMENT ON "DB2ADMIN".T_XLGZGL_TYPE ( 
	ID IS '编号',
	LXMC IS '类型名称',
	XLLXMS IS '心理类型维护' );

COMMIT;

RUNSTATS ON TABLE "DB2ADMIN".T_XLGZGL_TYPE
  ALLOW WRITE ACCESS;
  
  ALTER TABLE "DB2ADMIN"."T_XLGZGL_TYPE"
  ADD PRIMARY KEY
    ("ID");

SET SCHEMA = 'DB2ADMIN';

COMMIT;

你可能感兴趣的:(db2)