/**Begin D:\pdm\PDM_UPGRADE\pdm_new\RIM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_ATTACH' AND KSQL_COL_NAME ='FATTACH_CATEGORY') 
 ALTER TABLE T_RIM_ATTACH ADD (FATTACH_CATEGORY BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_ATTACH' AND KSQL_COL_NAME ='FFILE_EXTENSION') 
 ALTER TABLE T_RIM_ATTACH ADD (FFILE_EXTENSION NVARCHAR(8) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_RIM_ATTACH' AND KSQL_COL_NAME ='FRESOURCE') 
 ALTER TABLE T_RIM_ATTACH ADD (FRESOURCE NVARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_RIM_CONTRACT') 
 CREATE TABLE T_RIM_CONTRACT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FUID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIRSTPARTYNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FSECONDPARTYNAME NVARCHAR(150) DEFAULT ' ' NOT NULL,
FTITLE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FEFFECTIVEDATE DATETIME,
FEXPIREDDATE DATETIME,
FTOTALPAGE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFIELDPAGEIN NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(200) DEFAULT ' ' NOT NULL,
FCONTRACTNO NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCOLLECTTIME DATETIME,
FCOLLECTSOURCE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL
);



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