
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PLANSPLITMAPENTRY') 
CREATE TABLE T_AR_PLANSPLITMAPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDETAILKEY VARCHAR(255) DEFAULT ' ' NOT NULL,
FDETAILNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FPLANKEY VARCHAR(255) DEFAULT ' ' NOT NULL,
FPLANNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PLANSPLITMAPPING') 
 CREATE TABLE T_AR_PLANSPLITMAPPING (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PLANSPLITSCHEME') 
 CREATE TABLE T_AR_PLANSPLITSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(160) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FSYSPRESET CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PLANSPLITSCHEME_L') 
 CREATE TABLE T_AR_PLANSPLITSCHEME_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PSSCHEME_CENTRY') 
 CREATE TABLE T_AR_PSSCHEME_CENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELD VARCHAR(255) DEFAULT ' ' NOT NULL,
FCONDITION VARCHAR(30) DEFAULT ' ' NOT NULL,
FFIELDVALUE NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FLOGIC VARCHAR(255) DEFAULT ' ' NOT NULL,
FCLARGEVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLARGEVALUE_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PSSCHEME_DENTRY') 
 CREATE TABLE T_AR_PSSCHEME_DENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDETAILKEY VARCHAR(255) DEFAULT ' ' NOT NULL,
FPLANKEY VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_AR_PSSCHEME_OENTRY') 
 CREATE TABLE T_AR_PSSCHEME_OENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL
);

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