/**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' AND KSQL_COL_NAME ='FSYSTEMSOURCE') 
 ALTER TABLE T_SIM_VATINVOICE ADD (FSYSTEMSOURCE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SIM_RED_INFO' AND KSQL_COL_NAME ='FBILLNO') 
 ALTER TABLE T_SIM_RED_INFO ADD (FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_SIM_BATCH', 'FBUYERNAME', 'NVARCHAR(150)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FBUYERADDR', 'NVARCHAR(180)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FBUYERBANK', 'NVARCHAR(180)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FSALERNAME', 'NVARCHAR(150)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FSALERADDR', 'NVARCHAR(180)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FSALERBANK', 'NVARCHAR(180)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SIM_BATCH', 'FMAINREASON', 'NVARCHAR(1500)', 'NOT NULL', '0100', ''' ''';


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