IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_ASSETENTRY') 
 CREATE TABLE T_ER_ASSETENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FASSETBILLNO BIGINT DEFAULT 0 NOT NULL,
FASSETNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FASSETNAME VARCHAR(200) DEFAULT ' ' NOT NULL,
FASSETCAT BIGINT DEFAULT 0 NOT NULL,
FASSETMODEL VARCHAR(200) DEFAULT ' ' NOT NULL,
FASSETCOSTDEPTID BIGINT DEFAULT 0 NOT NULL,
FASSETUSERID BIGINT DEFAULT 0 NOT NULL,
FASSETSTOREPLACE BIGINT DEFAULT 0 NOT NULL,
FSUBJECTMATTER VARCHAR(150) DEFAULT ' ' NOT NULL,
FASSETUNIT BIGINT DEFAULT 0 NOT NULL,
FASSETQUANTITY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICEWITHOUTTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FHAPPENDATE DATETIME,
FENTRYCURRENCY BIGINT DEFAULT 0 NOT NULL,
FEXPQUOTETYPE CHAR(1) DEFAULT '0' NOT NULL,
FEXCHANGERATE DECIMAL(23,10) DEFAULT 1 NOT NULL,
FEXPENSEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURREXPENSEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURENTRYAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FORIENTRYAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FIS_SPECIAL_INVOICE CHAR(1) DEFAULT '0' NOT NULL,
FREMARK VARCHAR(255) DEFAULT ' ' NOT NULL,
FMOBILEDELDONEFLAG INT DEFAULT 0 NOT NULL,
FASSETSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FASSETENTRYID BIGINT DEFAULT 0 NOT NULL,
FASSETSRCBILLNO VARCHAR(200) DEFAULT ' ' NOT NULL
);
EXEC P_ALTERPK 'PK_T_ER_ASSETENTRY', 'T_ER_ASSETENTRY', 'FDETAILID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_PUBREIM_ASSET_FSEQ') CREATE INDEX IDX_ER_PUBREIM_ASSET_FSEQ ON T_ER_ASSETENTRY ( FID ,FSEQ );