/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\HPDI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATABILLENT' AND KSQL_COL_NAME ='FUPDATEEXPIRYDATE')
 ALTER TABLE T_HPDI_BIZDATABILLENT ADD (FUPDATEEXPIRYDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATABILLENT' AND KSQL_COL_NAME ='FUPDATEDDESC')
 ALTER TABLE T_HPDI_BIZDATABILLENT ADD (FUPDATEDDESC NVARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HPDI_BIZDATAOPERATEHIS')
 CREATE TABLE T_HPDI_BIZDATAOPERATEHIS (
FID BIGINT DEFAULT 0 NOT NULL,
FEMPPOSORGRELID BIGINT DEFAULT 0 NOT NULL,
FBIZITEMID BIGINT DEFAULT 0 NOT NULL,
FCURRENTBIZDATACODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FOPERATEBIZDATACODE VARCHAR(255) DEFAULT ' ' NOT NULL,
FBEFORUPDATEDATE DATETIME,
FAFTERUPDATEDATE DATETIME,
FOPERATETYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FOPERATER BIGINT DEFAULT 0 NOT NULL,
FOPERATETIME DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATA' AND KSQL_COL_NAME ='FUPDATEDDESC')
 ALTER TABLE T_HPDI_BIZDATA ADD (FUPDATEDDESC VARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATA' AND KSQL_COL_NAME ='FRELATIONRECORD')
 ALTER TABLE T_HPDI_BIZDATA ADD (FRELATIONRECORD VARCHAR(2) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_BIZDATA' AND KSQL_COL_NAME ='FBILLTYPE')
 ALTER TABLE T_HPDI_BIZDATA ADD (FBILLTYPE VARCHAR(2) DEFAULT ' ' NOT NULL );

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