IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ILLEGAL_OPERATE_LOG') 
 CREATE TABLE T_FA_ILLEGAL_OPERATE_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPDESC NVARCHAR(200) DEFAULT ' ' NOT NULL,
FOPDATE DATETIME,
FORG NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATELOG NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPERATELOG_TAG NCLOB
);

EXEC P_ALTERPK 'PK_T_FA_ILLEGAL_OPERATE_LOG', 'T_FA_ILLEGAL_OPERATE_LOG', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FA_ILLEGAL_OPERATE_LOG' AND KSQL_INDNAME = 'IDX_FA_ILL_OP_LOG_FORG') CREATE INDEX IDX_FA_ILL_OP_LOG_FORG ON T_FA_ILLEGAL_OPERATE_LOG ( FORG ,FENTITYID ,FOPNAME );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_FA_ILLEGAL_OPERATE_LOG' AND KSQL_INDNAME = 'IDX_FA_ILL_OP_LOG_FOPDATE') CREATE INDEX IDX_FA_ILL_OP_LOG_FOPDATE ON T_FA_ILLEGAL_OPERATE_LOG ( FOPDATE );