/**Begin D:\scm_code\PDM_UPGRADE_1.3\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm2\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INVOICE' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INVOICE ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_AIR' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_AIR ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_GENERAL' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_GENERAL ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_OTHER' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_OTHER ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_QUOTA' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_QUOTA ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TAX_PROOF' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TAX_PROOF ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TAXI' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TAXI ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRAIN' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TRAIN ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRANSPORT' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TRANSPORT ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_CUSTOM' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_CUSTOM ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_FINANCIAL' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_FINANCIAL ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TRAIN_REFUND' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TRAIN_REFUND ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_MOTOR' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_MOTOR ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_MOTOR' AND KSQL_COL_NAME ='FPROXY_SALER_NAME') 
 ALTER TABLE T_RIM_INV_MOTOR ADD (FPROXY_SALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_MOTOR' AND KSQL_COL_NAME ='FPROXY_SALER_TAX_NO') 
 ALTER TABLE T_RIM_INV_MOTOR ADD (FPROXY_SALER_TAX_NO NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FPROXY_SALER_NAME') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FPROXY_SALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FPROXY_SALER_TAX_NO') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FPROXY_SALER_TAX_NO NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FREMAIN_DEDUCT') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FREMAIN_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FCURRENT_DEDUCT') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FCURRENT_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FAVAIL_DEDUCT') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FAVAIL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_ORDINARY' AND KSQL_COL_NAME ='FTOTAL_DEDUCT') 
 ALTER TABLE T_RIM_INV_ORDINARY ADD (FTOTAL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FPROXY_SALER_NAME') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FPROXY_SALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FPROXY_SALER_TAX_NO') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FPROXY_SALER_TAX_NO NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FTOTAL_DEDUCT') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FTOTAL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FAVAIL_DEDUCT') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FAVAIL_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FCURRENT_DEDUCT') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FCURRENT_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_SPECIAL' AND KSQL_COL_NAME ='FREMAIN_DEDUCT') 
 ALTER TABLE T_RIM_INV_SPECIAL ADD (FREMAIN_DEDUCT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TOLL' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_TOLL ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TOLL' AND KSQL_COL_NAME ='FPROXY_SALER_NAME') 
 ALTER TABLE T_RIM_INV_TOLL ADD (FPROXY_SALER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_TOLL' AND KSQL_COL_NAME ='FPROXY_SALER_TAX_NO') 
 ALTER TABLE T_RIM_INV_TOLL ADD (FPROXY_SALER_TAX_NO NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_INV_USEDCAR' AND KSQL_COL_NAME ='FPROJECT') 
 ALTER TABLE T_RIM_INV_USEDCAR ADD (FPROJECT BIGINT DEFAULT 0 NOT NULL );

/**End D:\scm_code\PDM_UPGRADE_1.3\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm2\RIM_table.sql **/
