/**Begin D:\pdm\PDM_UPGRADE\pdm_new\RIM_table.sql **/
 EXEC p_AlterColumn 'T_RIM_INVOICE_FILE', 'FFILE_HASH', 'NVARCHAR(200)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_RIM_INVOICE_FILE', 'FORIGINAL_FILENAME', 'NVARCHAR(200)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INVOICE_FILE_HIS2') 
 CREATE TABLE T_RIM_INVOICE_FILE_HIS2 (
FID BIGINT DEFAULT 0 NOT NULL,
FSERIAL_NO NVARCHAR(36) DEFAULT ' ' NOT NULL,
FFILE_HASH NVARCHAR(200) DEFAULT ' ' NOT NULL,
FORIGINAL_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPDF_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FOFD_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FIMAGE_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FSNAPSHOT_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FICON_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FROTATION_ANGLE INT DEFAULT 0 NOT NULL,
FREGION NVARCHAR(35) DEFAULT ' ' NOT NULL,
FPIXEL NVARCHAR(20) DEFAULT ' ' NOT NULL,
FTENANT_NO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATE_TIME DATETIME,
FUPDATE_TIME DATETIME,
FORIGINAL_STATE NVARCHAR(2) DEFAULT ' ' NOT NULL,
FORIGINAL_FILENAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FOPERATE_TIME DATETIME,
FTRACEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FXML_URL NVARCHAR(300) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_INVOICE_SNAPSHOT') 
 CREATE TABLE T_RIM_INVOICE_SNAPSHOT (
FID BIGINT DEFAULT 0 NOT NULL,
FFILE_HASH NVARCHAR(200) DEFAULT ' ' NOT NULL,
FFILE_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FCREATE_TIME DATETIME,
FUPDATE_TIME DATETIME,
FTRACEID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILE_TYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILE_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FSNAPSHOT_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FPDF_URL NVARCHAR(300) DEFAULT ' ' NOT NULL,
FSERIAL_NO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEAL_TIMES BIGINT DEFAULT 0 NOT NULL
);



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