/**Begin D:\pdm\PDM_UPGRADE\pdm_new\BDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_HIS_SYNC_LOG') 
 CREATE TABLE T_RIM_HIS_SYNC_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FSTART_TIME DATETIME,
FEND_TIME DATETIME,
FSUCCESS INT DEFAULT 0 NOT NULL,
FPAGE_NO INT DEFAULT 0 NOT NULL,
FTAX_NO VARCHAR(30) DEFAULT ' ' NOT NULL,
FCOMPANY_NAME VARCHAR(150) DEFAULT ' ' NOT NULL,
FCLIENTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FDEAL_TIMES INT DEFAULT 0 NOT NULL,
FSYNC_TYPE VARCHAR(4) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(4) DEFAULT ' ' NOT NULL,
FDATA_DATE VARCHAR(20) DEFAULT ' ' NOT NULL,
FMSG VARCHAR(1000) DEFAULT ' ' NOT NULL
);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_HIS_SYNC_LOG' AND KSQL_COL_NAME ='FDATA_DATE_END') 
 ALTER TABLE T_RIM_HIS_SYNC_LOG ADD (FDATA_DATE_END DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_HIS_SYNC_LOG' AND KSQL_COL_NAME ='FAPPID') 
 ALTER TABLE T_RIM_HIS_SYNC_LOG ADD (FAPPID VARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_HIS_SYNC_LOG' AND KSQL_COL_NAME ='FDATA_DATE_START') 
 ALTER TABLE T_RIM_HIS_SYNC_LOG ADD (FDATA_DATE_START DATETIME );



/**End D:\pdm\PDM_UPGRADE\pdm_new\BDM_table.sql **/
