/**Begin D:\tools\PDM_UPGRADE\PDM1\HIES_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIRENTITYCFG')
 CREATE TABLE T_HIES_VIRENTITYCFG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIROBJENTITYREL')
 CREATE TABLE T_HIES_VIROBJENTITYREL (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FJOINTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FJOINENTITYID BIGINT DEFAULT 0 NOT NULL,
FVIRENTITYCFGID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIROBJJOINCOND')
 CREATE TABLE T_HIES_VIROBJJOINCOND (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FLEFTPROP VARCHAR(300) DEFAULT ' ' NOT NULL,
FCOMPARETYPE VARCHAR(50) DEFAULT '=' NOT NULL,
FRIGHTPROP VARCHAR(300) DEFAULT ' ' NOT NULL,
FRIGHTPROPTYPE VARCHAR(10) DEFAULT 'field' NOT NULL,
FRIGHTPROPVAL NCLOB,
FLOGICTYPE VARCHAR(10) DEFAULT 'and' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIROBJJOINENTITY')
 CREATE TABLE T_HIES_VIROBJJOINENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL,
FVIRENTITYCFGID BIGINT DEFAULT 0 NOT NULL
);


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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIROBJQUERYFIELD')
 CREATE TABLE T_HIES_VIROBJQUERYFIELD (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FORIFIELDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FISENTRYFIELD CHAR(1) DEFAULT '0' NOT NULL,
FISSUBENTRYFIELD CHAR(1) DEFAULT '0' NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDALIAS VARCHAR(300) DEFAULT ' ' NOT NULL,
FFIELDPATH VARCHAR(300) DEFAULT ' ' NOT NULL,
FVALUETYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FCOMPLEXTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FCONTROLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FVIRENTITYCFGID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_VIROBJQUERYFIELD_L')
 CREATE TABLE T_HIES_VIROBJQUERYFIELD_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FORIFIELDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_HRVIRENTITYREG')
 CREATE TABLE T_HIES_HRVIRENTITYREG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FENTITYID VARCHAR(50) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HIES_HRVIRENTITYREL')
 CREATE TABLE T_HIES_HRVIRENTITYREL (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FENTITYFIELD VARCHAR(200) DEFAULT ' ' NOT NULL,
FCONDITION VARCHAR(10) DEFAULT ' ' NOT NULL,
FRELENTITYFIELD VARCHAR(200) DEFAULT ' ' NOT NULL,
FLEFTPARENTALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FLEFTALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FLEFTVALUETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTPARENTALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTALIAS VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTVALUETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTBASEDATAID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTENUMID VARCHAR(50) DEFAULT ' ' NOT NULL,
FRIGHTTYPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

/**End D:\tools\PDM_UPGRADE\PDM1\HIES_table.sql **/
