
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BOTP_LINK_LOG')
 CREATE TABLE T_BOTP_LINK_LOG (
    FID BIGINT DEFAULT 0 NOT NULL,
	FUSERID BIGINT DEFAULT 0 NOT NULL,
	FOPTYPE CHAR(1) DEFAULT '0' NOT NULL,
	FOPERATETIME DATETIME NULL,
	FSENTITYNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
	FSBILLNO VARCHAR(200) DEFAULT ' ' NOT NULL,
	FSTABLEID BIGINT DEFAULT 0 NOT NULL,
	FSBILLID BIGINT DEFAULT 0 NOT NULL,
	FSID BIGINT DEFAULT 0 NOT NULL,
	FTENTITYNUMBER VARCHAR(100) DEFAULT' ' NOT NULL,
	FTBILLNO VARCHAR(200) DEFAULT ' ' NOT NULL,
	FTTABLEID BIGINT DEFAULT 0 NOT NULL,
	FTBILLID BIGINT DEFAULT 0 NOT NULL,
	FITD BIGINT DEFAULT 0 NOT NULL,
	FDESC VARCHAR(255) DEFAULT ' ' NOT NULL,
	FDESC_TAG NCLOB NULL
	);
EXEC P_ALTERPK 'PK_T_BOTP_LINK_LOG', 'T_BOTP_LINK_LOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BOTP_LINK_LOG_FSBILLNO') CREATE INDEX IDX_T_BOTP_LINK_LOG_FSBILLNO ON T_BOTP_LINK_LOG ( FSBILLNO );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BOTP_LINK_LOG_FSBILLID') CREATE INDEX IDX_T_BOTP_LINK_LOG_FSBILLID ON T_BOTP_LINK_LOG ( FSBILLID );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BOTP_LINK_LOG_FTBILLNO') CREATE INDEX IDX_T_BOTP_LINK_LOG_FTBILLNO ON T_BOTP_LINK_LOG ( FTBILLNO );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BOTP_LINK_LOG_FTBILLID') CREATE INDEX IDX_T_BOTP_LINK_LOG_FTBILLID ON T_BOTP_LINK_LOG ( FTBILLID );
