/**Begin D:\d_desk\pdm\PDM_UPGRADE_1.1\PDM_UPGRADE\pdm1\SIM_table.sql **/
 EXEC p_AlterColumn 'T_SIM_VATINVOICE_E', 'FRESULT', 'VARCHAR(300)', 'NOT NULL', '1100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FBUYERPROPERTY') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FBUYERPROPERTY VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FBILLDATE') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FBILLDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_E' AND KSQL_COL_NAME ='FBATCHBELONG') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FBATCHBELONG 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 ='FISSUESTATUS') 
 ALTER TABLE T_SIM_VATINVOICE_E ADD (FISSUESTATUS VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_ITEM' AND KSQL_COL_NAME ='FDISCOUNTAMOUNT') 
 ALTER TABLE T_SIM_VATINVOICE_ITEM ADD (FDISCOUNTAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_ITEM' AND KSQL_COL_NAME ='FDISCOUNTRATE') 
 ALTER TABLE T_SIM_VATINVOICE_ITEM ADD (FDISCOUNTRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_VATINVOICE_ITEM' AND KSQL_COL_NAME ='FSPBM') 
 ALTER TABLE T_SIM_VATINVOICE_ITEM ADD (FSPBM VARCHAR(50) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_SIM_RED_INFO_ITEM', 'FTAXFLAG', 'NVARCHAR(10)', 'NOT NULL', '0100', ''' ''';


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