/**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_OPTPL' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_OPTPL ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPTPL' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_OPTPL ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPTPL' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_OPTPL ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPTPL' AND KSQL_COL_NAME ='FALIAS') 
 ALTER TABLE T_HPDI_OPTPL ADD (FALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACT' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_PAYROLLACT ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACT' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_PAYROLLACT ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACT' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_PAYROLLACT ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACT' AND KSQL_COL_NAME ='FALIAS') 
 ALTER TABLE T_HPDI_PAYROLLACT ADD (FALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTGTPL' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_PAYROLLACTGTPL ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTGTPL' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_PAYROLLACTGTPL ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTGTPL' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_PAYROLLACTGTPL ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTGTPL' AND KSQL_COL_NAME ='FALIAS') 
 ALTER TABLE T_HPDI_PAYROLLACTGTPL ADD (FALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TRIGGERCOLLA' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_TRIGGERCOLLA ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TRIGGERCOLLA' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_TRIGGERCOLLA ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TRIGGERCOLLA' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_TRIGGERCOLLA ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_TRIGGERCOLLA' AND KSQL_COL_NAME ='FALIAS') 
 ALTER TABLE T_HPDI_TRIGGERCOLLA ADD (FALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPPKG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_OPPKG ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPPKG' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_OPPKG ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPPKG' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_OPPKG ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_OPPKG' AND KSQL_COL_NAME ='FALIAS') 
 ALTER TABLE T_HPDI_OPPKG ADD (FALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HPDI_PAYROLLACTG' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_HPDI_PAYROLLACTG ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );

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