/**Begin D:\tools\db\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm1\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_EXPENSE_TYPE' AND KSQL_COL_NAME ='FOPERATE_ATTACH_UPLOAD')
 ALTER TABLE T_RIM_EXPENSE_TYPE ADD (FOPERATE_ATTACH_UPLOAD NVARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_DOWNLOAD_UPLODETAIL')
 CREATE TABLE T_RIM_DOWNLOAD_UPLODETAIL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSERVICE_URL NVARCHAR(350) DEFAULT ' ' NOT NULL,
FRESULT NVARCHAR(10) DEFAULT ' ' NOT NULL
); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_MOTOR' AND KSQL_COL_NAME ='FDELETE')
 ALTER TABLE T_RIM_INV_MOTOR ADD (FDELETE NVARCHAR(4) DEFAULT '1' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FDELETE')
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FDELETE NVARCHAR(4) DEFAULT '1' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FDELETE')
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FDELETE NVARCHAR(4) DEFAULT '1' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TOLL' AND KSQL_COL_NAME ='FDELETE')
 ALTER TABLE T_RIM_INV_TOLL ADD (FDELETE NVARCHAR(4) DEFAULT '1' );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_USEDCAR' AND KSQL_COL_NAME ='FDELETE')
 ALTER TABLE T_RIM_INV_USEDCAR ADD (FDELETE NVARCHAR(4) DEFAULT '1' ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_AIR' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_AIR ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_AIR' AND KSQL_COL_NAME ='FTICKET_CHANGES') 
 ALTER TABLE T_RIM_INV_AIR ADD (FTICKET_CHANGES NVARCHAR(4) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_GENERAL' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_GENERAL ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OTHER' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_OTHER ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_QUOTA' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_QUOTA ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TAX_PROOF' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_TAX_PROOF ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TAXI' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_TAXI ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRAIN' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_TRAIN ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRANSPORT' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_TRANSPORT ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_CUSTOM' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_CUSTOM ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_FINANCIAL' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_FINANCIAL ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRAIN_REFUND' AND KSQL_COL_NAME ='FDELETE') 
 ALTER TABLE T_RIM_INV_TRAIN_REFUND ADD (FDELETE NVARCHAR(4) DEFAULT '1' NOT NULL ); 
/**End D:\tools\db\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm1\RIM_table.sql **/
