/**Begin D:\PDM_UPGRADE_1.3\PDM_UPGRADE\pdm1\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_BATCH_DEDUCT') 
 CREATE TABLE T_RIM_BATCH_DEDUCT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATEDATE DATETIME,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FORG BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_BATCHDEDUCT_USERORG') 
 CREATE TABLE T_RIM_BATCHDEDUCT_USERORG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTAXPAYER_ORG BIGINT DEFAULT 0 NOT NULL,
FTAXPAYER_TAX_NO NVARCHAR(32) DEFAULT ' ' NOT NULL,
FTAXPAYER_NAME NVARCHAR(120) DEFAULT ' ' NOT NULL,
FCONFIRM_SECRET NVARCHAR(32) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_SELECT_LOG' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_RIM_SELECT_LOG ADD (FDESCRIPTION NVARCHAR(120) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_SELECT_LOG' AND KSQL_COL_NAME ='FRESULT_JSON') 
 ALTER TABLE T_RIM_SELECT_LOG ADD (FRESULT_JSON VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_SELECT_LOG' AND KSQL_COL_NAME ='FRESULT_JSON_TAG') 
 ALTER TABLE T_RIM_SELECT_LOG ADD (FRESULT_JSON_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_SELECT_LOG' AND KSQL_COL_NAME ='FSTATISTICS_STATUS') 
 ALTER TABLE T_RIM_SELECT_LOG ADD (FSTATISTICS_STATUS NVARCHAR(2) DEFAULT ' ' NOT NULL );

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