/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_BIZDATARECORD') 
 CREATE TABLE T_HPDI_BIZDATARECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FEMPPOSORGRELVID BIGINT DEFAULT 0 NOT NULL,
FEMPPOSORGRELID BIGINT DEFAULT 0 NOT NULL,
FSALARYFILEID BIGINT DEFAULT 0 NOT NULL,
FPAYROLLGRPID BIGINT DEFAULT 0 NOT NULL,
FBIZDATE DATETIME,
FEFFECTIVEDATE DATETIME,
FEXPIRYDATE DATETIME,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FSUBMITDATE DATETIME,
FCALSALARYDATE DATETIME,
FBIZDATASTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FTRANSSALARYERROR VARCHAR(2) DEFAULT ' ' NOT NULL,
FBIZDATACODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FBATCHNUM VARCHAR(255) DEFAULT ' ' NOT NULL,
FBIZITEMGROUPID BIGINT DEFAULT 0 NOT NULL,
FSUBMISSION VARCHAR(2) DEFAULT ' ' NOT NULL,
FCALPERIODID BIGINT DEFAULT 0 NOT NULL,
FAPPLYNO VARCHAR(60) DEFAULT ' ' NOT NULL,
FUPDATEDDESC VARCHAR(1000) DEFAULT ' ' NOT NULL,
FRELATIONRECORD VARCHAR(2) DEFAULT ' ' NOT NULL,
FBILLTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FCALFREQUENCYID BIGINT DEFAULT 0 NOT NULL,
FOVERDUE VARCHAR(2) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATA' AND KSQL_COL_NAME ='FBIZDATARECORDID') 
 ALTER TABLE T_HPDI_BIZDATA ADD (FBIZDATARECORDID BIGINT DEFAULT 0 NOT NULL );
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_table.sql **/
