/**Begin D:\PDM_UPGRADE\PDM1\FCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_L')
 CREATE TABLE T_FCS_PAYACCESS_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_SET_L')
 CREATE TABLE T_FCS_PAYACCESS_SET_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_RECORD_L')
 CREATE TABLE T_FCS_PAYACCESS_RECORD_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_BL_L')
 CREATE TABLE T_FCS_PAYACCESS_BL_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS')
 CREATE TABLE T_FCS_PAYACCESS (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FDESTENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISCUSTOMENTITY CHAR(1) DEFAULT '0' NOT NULL,
FCUSTOMSIGN NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSRCENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFILTER_TAG NCLOB DEFAULT ' ',
FOPERATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISBOTPADD CHAR(1) DEFAULT '0' NOT NULL,
FDESTLKFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCLKPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTLKPKFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_SET')
 CREATE TABLE T_FCS_PAYACCESS_SET (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FISFULLLINK CHAR(1) DEFAULT '0' NOT NULL,
FASYNC CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_RECORD')
 CREATE TABLE T_FCS_PAYACCESS_RECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FSRCENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FDESTENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCIDPROP NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDESTIDPROP NVARCHAR(30) DEFAULT ' ' NOT NULL,
FISREPEATRESULT CHAR(1) DEFAULT '0' NOT NULL,
FISEXCESSRESULT CHAR(1) DEFAULT '0' NOT NULL,
FSRCENTRYPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLPKID BIGINT DEFAULT 0 NOT NULL,
FDESTENTRYPROP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESTBILLPKID BIGINT DEFAULT 0 NOT NULL,
FNEWWAY NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFULLLINKID NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FBATCHNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FERRORMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYACCESS_BL')
 CREATE TABLE T_FCS_PAYACCESS_BL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDESTENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_PAYTRACELOG')
 CREATE TABLE T_FCS_PAYTRACELOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) 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,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FSOURCE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FPAYSTEP NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCLASSNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FMETHODNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FTAGINFO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDETAILINFO NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDETAILINFO_TAG NCLOB DEFAULT ' ',
FLINENUM INT DEFAULT 0 NOT NULL,
FBILLTYPE NVARCHAR(60) DEFAULT ' ' NOT NULL,
FEXCEPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEXCEPTION_TAG NCLOB DEFAULT ' ',
FLEVEL NVARCHAR(30) DEFAULT ' ' NOT NULL,
FTRACEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLNUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_CHECKCTRL_L')
 CREATE TABLE T_FCS_CHECKCTRL_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FREPEATMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCTRLMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_REPEATCTRL_WL')
 CREATE TABLE T_FCS_REPEATCTRL_WL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FDESTENTITYID BIGINT DEFAULT 0 NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_REPEATCTRL_WL_L')
 CREATE TABLE T_FCS_REPEATCTRL_WL_L (
FPKID NVARCHAR(30) DEFAULT '0' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_CHECKCTRL_AMTCTRL')
 CREATE TABLE T_FCS_CHECKCTRL_AMTCTRL (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSRCAMTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCAMTFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCRULE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTARGETAMTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTARGETAMTFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTARGETRULE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_CHECKCTRL_SUBAMT')
 CREATE TABLE T_FCS_CHECKCTRL_SUBAMT (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FOTHERTARGETENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOTHERTARGETAMTFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOTHERTARGETAMTFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_CHECKCTRL')
 CREATE TABLE T_FCS_CHECKCTRL (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FCTRLENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISPRESET CHAR(1) DEFAULT '0' NOT NULL,
FPAYACCESSID BIGINT DEFAULT 0 NOT NULL,
FISCTRLAMT CHAR(1) DEFAULT '0' NOT NULL,
FSRCENTITYID NVARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFILTER_TAG NCLOB,
FCUSTOMSIGN NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISREPEAT CHAR(1) DEFAULT '0' NOT NULL,
FREPEATOP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISBYRECORD CHAR(1) DEFAULT '0' NOT NULL,
FSRCBILLIDFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FREPEATMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCTRLAMTOP NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCTRLRULE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FISBOTP CHAR(1) DEFAULT '0' NOT NULL,
FISLOAD CHAR(1) DEFAULT '0' NOT NULL,
FISMATCH CHAR(1) DEFAULT '0' NOT NULL,
FCTRLMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOPREAT NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FCS_REPEATCTRLLOG')
 CREATE TABLE T_FCS_REPEATCTRLLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) 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,
FSOURCEBILLID BIGINT DEFAULT 0 NOT NULL,
FCOSTTIME INT DEFAULT 0 NOT NULL,
FSOURCEBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FEXCEPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEXCEPTION_TAG NCLOB DEFAULT ' ',
FTRACEID NVARCHAR(60) DEFAULT ' ' NOT NULL,
FREPEATSETID BIGINT DEFAULT 0 NOT NULL,
FLOGTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL,
FDESTBILLID BIGINT DEFAULT 0 NOT NULL,
FDESTBILLTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL
);

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_REPEATCTRLLOG' AND KSQL_COL_NAME IN ('FDESTBILLTYPE'))
 ALTER TABLE T_FCS_REPEATCTRLLOG ADD (FDESTBILLTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_REPEATCTRLLOG' AND KSQL_COL_NAME IN ('FLOGTYPE'))
 ALTER TABLE T_FCS_REPEATCTRLLOG ADD (FLOGTYPE NVARCHAR(80) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_PAYACCESS_RECORD' AND KSQL_COL_NAME IN ('FFULLLINKID'))
 ALTER TABLE T_FCS_PAYACCESS_RECORD ADD (FFULLLINKID NVARCHAR(2000) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_PAYACCESS_RECORD' AND KSQL_COL_NAME IN ('FBATCHNO'))
 ALTER TABLE T_FCS_PAYACCESS_RECORD ADD (FBATCHNO NVARCHAR(80) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FCS_PAYACCESS_RECORD' AND KSQL_COL_NAME IN ('FERRORMESSAGE'))
 ALTER TABLE T_FCS_PAYACCESS_RECORD ADD (FERRORMESSAGE NVARCHAR(255) DEFAULT ' ' NOT NULL );

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