/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_STRUC')
 CREATE TABLE T_FAH_FLEX_STRUC (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FOWNERNUM VARCHAR(30) DEFAULT ' ' NOT NULL,
FFIELDUSAGETYPE SMALLINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFLEXFIELDNUM VARCHAR(30) DEFAULT ' ' NOT NULL,
FATTNUM VARCHAR(50) DEFAULT ' ' NOT NULL,
FATTNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FATTDATATYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FREFENTITY VARCHAR(50) DEFAULT ' ' NOT NULL,
FREFTYPEID BIGINT DEFAULT 0 NOT NULL,
FREFFIELDNUM VARCHAR(30) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_STRUC_TYPE')
 CREATE TABLE T_FAH_FLEX_STRUC_TYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_VALUESET_TYPE')
 CREATE TABLE T_FAH_VALUESET_TYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTRUCID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_VALMAP_STRUC')
 CREATE TABLE T_FAH_VALMAP_STRUC (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_VALMAP_TYPE')
 CREATE TABLE T_FAH_VALMAP_TYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FSTRUCID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCHECKSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_VALUESET')
 CREATE TABLE T_FAH_FLEX_VALUESET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(150) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FVALUESETTYPEID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FEFFECTDATE DATETIME,
FEXPIREDATE DATETIME,
FTXTATTR1 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR2 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR3 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR4 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR5 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR6 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR7 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR8 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR9 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR10 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR11 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR12 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR13 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR14 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR15 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR16 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR17 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR18 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR19 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR20 NVARCHAR(150) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_MAPVAL')
 CREATE TABLE T_FAH_FLEX_MAPVAL (
FID BIGINT DEFAULT 0 NOT NULL,
FMAPTYPEID BIGINT DEFAULT 0 NOT NULL,
FSERIALNUMBER INT DEFAULT 0 NOT NULL,
FHASHCODE BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FEFFECTDATE DATETIME,
FEXPIREDATE DATETIME,
FMAPVALUETYPE CHAR(1) DEFAULT ' ' NOT NULL,
FHASMULVALUE CHAR(1) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FTXTATTR1 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR2 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR3 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR4 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR5 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR6 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR7 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR8 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR9 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR10 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR11 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR12 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR13 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR14 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR15 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR1 BIGINT DEFAULT 0 NOT NULL,
FIDATTR2 BIGINT DEFAULT 0 NOT NULL,
FIDATTR3 BIGINT DEFAULT 0 NOT NULL,
FIDATTR4 BIGINT DEFAULT 0 NOT NULL,
FIDATTR5 BIGINT DEFAULT 0 NOT NULL,
FIDATTR6 BIGINT DEFAULT 0 NOT NULL,
FIDATTR7 BIGINT DEFAULT 0 NOT NULL,
FIDATTR8 BIGINT DEFAULT 0 NOT NULL,
FIDATTR9 BIGINT DEFAULT 0 NOT NULL,
FIDATTR10 BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_VAL_TMP')
 CREATE TABLE T_FAH_FLEX_VAL_TMP (
FID BIGINT DEFAULT 0 NOT NULL,
FBATCHID BIGINT DEFAULT 0 NOT NULL,
FSRCTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FVALTYPEID BIGINT DEFAULT 0 NOT NULL,
FEXCELROWNUM INT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(150) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEFFECTDATE DATETIME,
FEXPIREDATE DATETIME,
FMAPVALUETYPE CHAR(1) DEFAULT ' ' NOT NULL,
FHASMULVALUE CHAR(1) DEFAULT ' ' NOT NULL,
FTXTATTR1 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR2 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR3 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR4 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR5 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR6 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR7 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR8 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR9 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR10 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR11 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR12 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR13 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR14 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR15 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR16 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR17 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR18 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR19 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTXTATTR20 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR1 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR2 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR3 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR4 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR5 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR6 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR7 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR8 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR9 NVARCHAR(150) DEFAULT ' ' NOT NULL,
FIDATTR10 NVARCHAR(150) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_MAPVAL_EN_TMP')
 CREATE TABLE T_FAH_FLEX_MAPVAL_EN_TMP (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBATCHID BIGINT DEFAULT 0 NOT NULL,
FEXCELROWNUM INT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCOLINDEX SMALLINT DEFAULT 0 NOT NULL,
FTXTATTR NVARCHAR(150) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_FLEX_IMPORT_LOG')
 CREATE TABLE T_FAH_FLEX_IMPORT_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBATCHID BIGINT DEFAULT 0 NOT NULL,
FSOURCETYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDATATYPEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FERROR NCLOB,
FERROR_TAG NCLOB,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);


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



/**End D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
