IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_CASWBLOG')
 CREATE TABLE T_ER_CASWBLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERNAME NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOPNAME VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPDESC NVARCHAR(10) DEFAULT ' ' NOT NULL,
FOPDATE DATETIME,
FTRACEID VARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEID BIGINT DEFAULT 0 NOT NULL,
FTARGETID BIGINT DEFAULT 0 NOT NULL,
FTARGEBILLTYPE CHAR(2) DEFAULT ' ' NOT NULL,
FSETP CHAR(2) DEFAULT ' ' NOT NULL,
FMSG NVARCHAR(20),
FMSG_TAG NCLOB
);

 EXEC P_ALTERPK 'PK_T_ER_CASWBLOG', 'T_ER_CASWBLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_CASWBLOG_FTARGETID') CREATE INDEX IDX_ER_CASWBLOG_FTARGETID ON T_ER_CASWBLOG ( FTARGETID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_CASWBLOG_FTRACEID') CREATE INDEX IDX_ER_CASWBLOG_FTRACEID ON T_ER_CASWBLOG ( FTRACEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_CASWBLOG_FOPDATE') CREATE INDEX IDX_ER_CASWBLOG_FOPDATE ON T_ER_CASWBLOG ( FOPDATE );
