/**Begin D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FCANREDTAXAMOUNT') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FCANREDTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FTERMINALNO') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FTERMINALNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FSPECIALREDFLAG') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FSPECIALREDFLAG VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FREDREASON') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FREDREASON VARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FINFOCODE') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FINFOCODE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_BATCH_E' AND KSQL_COL_NAME ='FSPECIALFLAG') 
 ALTER TABLE T_SIM_BATCH_E ADD (FSPECIALFLAG VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_BATCH_E' AND KSQL_COL_NAME ='FREDREASON') 
 ALTER TABLE T_SIM_BATCH_E ADD (FREDREASON VARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_RED_INFO' AND KSQL_COL_NAME ='FISSUEDATE') 
 ALTER TABLE T_SIM_RED_INFO ADD (FISSUEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_SIM_VATINVOICE ADD (FSOURCETYPE VARCHAR(30) DEFAULT ' ' NOT NULL );

/**End D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
