/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL' AND KSQL_COL_NAME IN ('FBIZTIME')) 
 ALTER TABLE T_BEI_TRANSDETAIL ADD (FBIZTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_BANKLOG_BAK') 
 CREATE TABLE T_BEI_BANKLOG_BAK (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(5) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FUSEORGID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCTRLSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FBANKLOGTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FTIME DATETIME,
FACCOUNTBANK VARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEBILLTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FEXECUTORID BIGINT DEFAULT 0 NOT NULL,
FISEXCEPTION VARCHAR(30) DEFAULT ' ' NOT NULL,
FSOURCEID VARCHAR(100) DEFAULT ' ' NOT NULL,
FEXCEPTIONMSG NCLOB,
FSENDINFO NCLOB,
FSENDINFO_TAG NCLOB,
FRECEIVEINFO NCLOB,
FRECEIVEINFO_TAG NCLOB,
FSENDEXCEPTIONINFO NCLOB,
FSENDEXCEPTIONINFO_TAG NCLOB,
FRECEIVEEXCEPTIONINFO NCLOB,
FRECEIVEEXCEPTIONINFO_TAG NCLOB,
FBIZEXCEPTIONINFO NCLOB,
FBIZEXCEPTIONINFO_TAG NCLOB,
FBANKINTERFACEID VARCHAR(100) DEFAULT ' ' NOT NULL,
FPAYEEACNT VARCHAR(100) DEFAULT ' ' NOT NULL,
FBANKINTERFACE VARCHAR(100) DEFAULT ' ' NOT NULL,
FSOURCEBILLNO VARCHAR(100) DEFAULT ' ' NOT NULL,
FTRANSTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLERID BIGINT DEFAULT 0 NOT NULL,
FENABLEDATE DATETIME,
FDISABLEDATE DATETIME,
FCOMPANYID BIGINT DEFAULT 0 NOT NULL,
FOPENORGID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TMC_INIT_L') 
 CREATE TABLE T_TMC_INIT_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(255) DEFAULT ' '
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TMC_INIT') 
 CREATE TABLE T_TMC_INIT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(5) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '0' 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,
FCONTENT VARCHAR(100) DEFAULT ' ' NOT NULL,
FSRCBILLCOUNT BIGINT DEFAULT 0 NOT NULL,
FSUCCESSCOUNT BIGINT DEFAULT 0 NOT NULL,
FSUCCESSTIME DATETIME,
FUPDATERESULT NCLOB,
FSRCENTITY VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCENTITY VARCHAR(100) DEFAULT ' ' NOT NULL,
FCLASSPATH VARCHAR(250) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_ELECRECEIPT' AND KSQL_COL_NAME IN ('FISARCHIVE')) 
 ALTER TABLE T_BEI_ELECRECEIPT ADD (FISARCHIVE CHAR(1) DEFAULT '0' NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BEI_ELECRECEIPT', 'FBASECURRENCYID', 'NULL', 'NULL', '1001', 'NULL';


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BEI_table.sql **/
