/**Begin D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTAPPLY')
 CREATE TABLE T_HDM_SECONDMENTAPPLY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBMAINORGID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FISEXISTSWORKFLOW CHAR(1) DEFAULT ' ' NOT NULL,
FISSUBMIT CHAR(1) DEFAULT ' ' NOT NULL,
FBARCODE VARCHAR(60) DEFAULT ' ' NOT NULL,
FINPUTDEVICETYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FEVENTEFFECTDATE DATETIME,
FBILLSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FAUDITSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FLABORRELTYPEID BIGINT DEFAULT 0 NOT NULL,
FLABORRELSTATUSID BIGINT DEFAULT 0 NOT NULL,
FPOSTYPEID BIGINT DEFAULT 0 NOT NULL,
FPOSSTATUSID BIGINT DEFAULT 0 NOT NULL,
FAFFRECORDID BIGINT DEFAULT 0 NOT NULL,
FAFFACTIONID BIGINT DEFAULT 0 NOT NULL,
FERMANFILEIFID BIGINT DEFAULT 0 NOT NULL,
FPERSONFIELD BIGINT DEFAULT 0 NOT NULL,
FPERSONID BIGINT DEFAULT 0 NOT NULL,
FBEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FBDEPEMPID BIGINT DEFAULT 0 NOT NULL,
FBMANAGESCOPEID BIGINT DEFAULT 0 NOT NULL,
FAEMPLOYEEID BIGINT DEFAULT 0 NOT NULL,
FADEPEMPID BIGINT DEFAULT 0 NOT NULL,
FAMANAGESCOPEID BIGINT DEFAULT 0 NOT NULL,
FSECDSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FSECDREASONID BIGINT DEFAULT 0 NOT NULL,
FSECDOUTINORDER VARCHAR(10) DEFAULT ' ' NOT NULL,
FSUBMITNOTICSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FEFFECTSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FSTOPNOTICSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FEFFECTTIME DATETIME,
FCOUNTRYOUTID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYOUTID BIGINT DEFAULT 0 NOT NULL,
FDEPTOUTID BIGINT DEFAULT 0 NOT NULL,
FPOSPATTERNOUT VARCHAR(10) DEFAULT ' ' NOT NULL,
FPOSITIONOUTID BIGINT DEFAULT 0 NOT NULL,
FSTANDARDPOSOUTID BIGINT DEFAULT 0 NOT NULL,
FJOBOUTID BIGINT DEFAULT 0 NOT NULL,
FLEAVEDATE DATETIME,
FOUTSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGOUTID BIGINT DEFAULT 0 NOT NULL,
FADMINORGOUTID BIGINT DEFAULT 0 NOT NULL,
FEMPGROUPOUTID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPOUT BIGINT DEFAULT 0 NOT NULL,
FCOUNTRYINID BIGINT DEFAULT 0 NOT NULL,
FCOMPANYINID BIGINT DEFAULT 0 NOT NULL,
FDEPTINID BIGINT DEFAULT 0 NOT NULL,
FCMPEMPINID BIGINT DEFAULT 0 NOT NULL,
FBASELOCATIONINID BIGINT DEFAULT 0 NOT NULL,
FINRADIOGROUPFIELD VARCHAR(10) DEFAULT ' ' NOT NULL,
FPOSITIONINID BIGINT DEFAULT 0 NOT NULL,
FSTANDARDPOSINID BIGINT DEFAULT 0 NOT NULL,
FJOBINID BIGINT DEFAULT 0 NOT NULL,
FREACHDATE DATETIME,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FDURATION INT DEFAULT 0 NOT NULL,
FINSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
FORGINID BIGINT DEFAULT 0 NOT NULL,
FADMINORGINID BIGINT DEFAULT 0 NOT NULL,
FEMPGROUPINID BIGINT DEFAULT 0 NOT NULL,
FJOBINORGID BIGINT DEFAULT 0 NOT NULL,
FTERMINATERSN NVARCHAR(500) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECONDMENTAPPLY_A')
 CREATE TABLE T_HDM_SECONDMENTAPPLY_A (
FID BIGINT DEFAULT 0 NOT NULL,
FPLANCOUNTRYINID BIGINT DEFAULT 0 NOT NULL,
FPLANCOMPANYINID BIGINT DEFAULT 0 NOT NULL,
FPLANDEPTINID BIGINT DEFAULT 0 NOT NULL,
FPLANCMPEMPIN BIGINT DEFAULT 0 NOT NULL,
FRADIOGROUPFIELD VARCHAR(10) DEFAULT ' ' NOT NULL,
FPLANPOSITIONINID BIGINT DEFAULT 0 NOT NULL,
FPLANSTANDARDPOSINID BIGINT DEFAULT 0 NOT NULL,
FPLANJOBID BIGINT DEFAULT 0 NOT NULL,
FPLANREACHDATE DATETIME,
FPLANSECDREASON BIGINT DEFAULT 0 NOT NULL,
FPLANSTARTDATE DATETIME,
FPLANENDDATE DATETIME,
FPLANDURATION INT DEFAULT 0 NOT NULL,
FPLANJOBINORGID BIGINT DEFAULT 0 NOT NULL,
FWORKROLEID BIGINT DEFAULT 0 NOT NULL,
FINDARKPOSITIONID BIGINT DEFAULT 0 NOT NULL,
FTERMINATETIME DATETIME,
FTERMINATEUSER BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATASOURCEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDINCHARGE')
 CREATE TABLE T_HDM_SECDINCHARGE (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDOUTSUPERIOR')
 CREATE TABLE T_HDM_SECDOUTSUPERIOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDOUTCHARGE')
 CREATE TABLE T_HDM_SECDOUTCHARGE (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDINSUPERIOR')
 CREATE TABLE T_HDM_SECDINSUPERIOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDPLANINCHA')
 CREATE TABLE T_HDM_SECDPLANINCHA (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_SECDPLANINSUP')
 CREATE TABLE T_HDM_SECDPLANINSUP (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
