IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLEBILL' AND KSQL_COL_NAME ='FVEHICLETYPE')
 ALTER TABLE T_ER_VEHICLEBILL ADD (FVEHICLETYPE CHAR(1) DEFAULT '1' NOT NULL );
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_er_vehiclecheckingbill' AND KSQL_COL_NAME ='FVEHICLETYPE')
 ALTER TABLE t_er_vehiclecheckingbill ADD (FVEHICLETYPE CHAR(1) DEFAULT '1' NOT NULL );
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\ER_table.sql **/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLEBILL' AND KSQL_COL_NAME ='FNOTICETIMES')
 ALTER TABLE T_ER_VEHICLEBILL ADD (FNOTICETIMES INT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_VEHICLEBILL' AND KSQL_COL_NAME ='FFEEDBACK')
 ALTER TABLE T_ER_VEHICLEBILL ADD (FFEEDBACK NVARCHAR(200) DEFAULT ' ' NOT NULL );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINBILL' AND KSQL_COL_NAME ='FNOTICETIMES')
 ALTER TABLE T_ER_TRAINBILL ADD (FNOTICETIMES INT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_TRAINBILL' AND KSQL_COL_NAME ='FFEEDBACK')
 ALTER TABLE T_ER_TRAINBILL ADD (FFEEDBACK NVARCHAR(200) DEFAULT ' ' NOT NULL );



 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELBILL' AND KSQL_COL_NAME ='FNOTICETIMES')
 ALTER TABLE T_ER_HOTELBILL ADD (FNOTICETIMES INT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_HOTELBILL' AND KSQL_COL_NAME ='FFEEDBACK')
 ALTER TABLE T_ER_HOTELBILL ADD (FFEEDBACK NVARCHAR(200) DEFAULT ' ' NOT NULL );


 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANEBILL' AND KSQL_COL_NAME ='FNOTICETIMES')
 ALTER TABLE T_ER_PLANEBILL ADD (FNOTICETIMES INT DEFAULT 0 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ER_PLANEBILL' AND KSQL_COL_NAME ='FFEEDBACK')
 ALTER TABLE T_ER_PLANEBILL ADD (FFEEDBACK NVARCHAR(200) DEFAULT ' ' NOT NULL );

EXEC p_AlterColumn 'T_ER_VEHICLEBILL', 'FFEEDBACK', 'NVARCHAR(255)', 'NOT NULL', '1111', '''0''';
EXEC p_AlterColumn 'T_ER_TRAINBILL', 'FFEEDBACK', 'NVARCHAR(255)', 'NOT NULL', '1111', '''0''';
EXEC p_AlterColumn 'T_ER_HOTELBILL', 'FFEEDBACK', 'NVARCHAR(255)', 'NOT NULL', '1111', '''0''';
EXEC p_AlterColumn 'T_ER_PLANEBILL', 'FFEEDBACK', 'NVARCHAR(255)', 'NOT NULL', '1111', '''0''';



