/**Begin D:\PDM_UPGRADE\PDM1\FCS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_CHANGEHISTORY')
 CREATE TABLE T_FCS_CHANGEHISTORY (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FBIZID BIGINT DEFAULT 0 NOT NULL,
FAPPLYID BIGINT DEFAULT 0 NOT NULL,
FAPPLYENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBIZENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREASON NVARCHAR(255) DEFAULT ' ',
FBILLINFO NVARCHAR(255) DEFAULT ' ',
FBILLINFO_TAG NCLOB,
FSEQNUMBER INT DEFAULT 0 NOT NULL,
FLASTVERSION CHAR(1) DEFAULT '0' NOT NULL,
FAPPLYBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_CHANGEHISTORY' AND KSQL_COL_NAME IN ('FISAPPLYCREATE'))
 ALTER TABLE T_FCS_CHANGEHISTORY ADD (FISAPPLYCREATE CHAR(1) DEFAULT '0' NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_SUSPECTBILL' AND KSQL_COL_NAME IN ('FSUSPECTSETID'))
 ALTER TABLE T_FCS_SUSPECTBILL ADD (FSUSPECTSETID BIGINT DEFAULT 0 NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\FCS_table.sql **/
