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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKBALANCE' AND KSQL_COL_NAME IN ('FDEBITAMOUNT'))
 ALTER TABLE T_BEI_BANKBALANCE ADD (FDEBITAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_BANKBALANCE' AND KSQL_COL_NAME IN ('FCREDITAMOUNT'))
 ALTER TABLE T_BEI_BANKBALANCE ADD (FCREDITAMOUNT DECIMAL(19,6) DEFAULT 0 NOT NULL );

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BEI_BANKBALANCE_SP')
 CREATE TABLE T_BEI_BANKBALANCE_SP (
FID BIGINT DEFAULT 0 NOT NULL,
FKEYCOL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBILLNAME NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FUPDATETIME BIGINT DEFAULT 0 NOT NULL,
FISNEW CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS NVARCHAR(80) DEFAULT ' ' NOT NULL,
FUPDATETYPE BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FUPDATERULEID NVARCHAR(80) DEFAULT ' ' NOT NULL,
FCREDITAMOUNT_SP DECIMAL(19,6) DEFAULT 0 NOT NULL,
FDEBITAMOUNT_SP DECIMAL(19,6) DEFAULT 0 NOT NULL
);

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