/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_INVENT_SPLITFIELD') 
 CREATE TABLE T_FA_INVENT_SPLITFIELD (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSPLITFIELD VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_INVENTSCHEMEENTRY' AND KSQL_COL_NAME ='FTASKRULE') 
 ALTER TABLE T_FA_INVENTSCHEMEENTRY ADD (FTASKRULE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_CARD_DYNAMIC') 
 CREATE TABLE T_FA_CARD_DYNAMIC (
FID BIGINT DEFAULT 0 NOT NULL,
FASSETBOOKID BIGINT DEFAULT 0 NOT NULL,
FREALCARDID BIGINT DEFAULT 0 NOT NULL,
FPERIODID BIGINT DEFAULT 0 NOT NULL,
FENTITYNAME VARCHAR(30) DEFAULT ' ' NOT NULL,
FCHANGEBILLID BIGINT DEFAULT 0 NOT NULL,
FDEPREUSEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_DEPRESPLITDETAIL' AND KSQL_COL_NAME ='FBILLNO') 
 ALTER TABLE T_FA_DEPRESPLITDETAIL ADD (FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_DEPRESPLITDETAIL' AND KSQL_COL_NAME ='FBILLSTATUS') 
 ALTER TABLE T_FA_DEPRESPLITDETAIL ADD (FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_DEPRESPLITDETAIL' AND KSQL_COL_NAME ='FAUDITORID') 
 ALTER TABLE T_FA_DEPRESPLITDETAIL ADD (FAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_DEPRESPLITDETAIL' AND KSQL_COL_NAME ='FAUDITDATE') 
 ALTER TABLE T_FA_DEPRESPLITDETAIL ADD (FAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_INVENT_TASKRULE') 
 CREATE TABLE T_FA_INVENT_TASKRULE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSPLITFIELDVALUE NVARCHAR(2000) DEFAULT ' ',
FSEQ INT DEFAULT 0 NOT NULL,
FINVENTPERSON BIGINT DEFAULT 0 NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FINVENTSCHEMEID BIGINT DEFAULT 0 NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_table.sql **/
