/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
EXEC p_AlterColumn 'T_FAH_REGBILL', 'FSRCBILLORGFIELD', 'VARCHAR(36)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_REGBILL' AND KSQL_COL_NAME ='FSRCBILLSTATUSFIELD')
ALTER TABLE T_FAH_REGBILL ADD (FSRCBILLSTATUSFIELD VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_REGBILL' AND KSQL_COL_NAME ='FWRITEBACKPLUGIN')
ALTER TABLE T_FAH_REGBILL ADD (FWRITEBACKPLUGIN VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_REGBILL_EN')
CREATE TABLE T_FAH_REGBILL_EN (
                                  FID BIGINT DEFAULT 0 NOT NULL,
                                  FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                  FSEQ INT DEFAULT 0 NOT NULL,
                                  FSRCBILLSTATUSVAL VARCHAR(255) DEFAULT ' ' NOT NULL,
                                  FSRCBILLDATEFIELDNUM VARCHAR(36) DEFAULT ' ' NOT NULL,
                                  FEVTSTATUSFIELDNUM VARCHAR(36) DEFAULT ' ' NOT NULL,
                                  FDESCRIPTION VARCHAR(500)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BILL_EVT_STATUS')
CREATE TABLE T_FAH_BILL_EVT_STATUS (
                                       FID BIGINT DEFAULT 0 NOT NULL,
                                       FMASTERID BIGINT DEFAULT 0 NOT NULL,
                                       FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
                                       FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                       FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
                                       FENABLE CHAR(1) DEFAULT '0' NOT NULL,
                                       FCREATETIME DATETIME,
                                       FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                       FMODIFYTIME DATETIME,
                                       FMODIFIERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BILL_EVT_STATUS_L')
CREATE TABLE T_FAH_BILL_EVT_STATUS_L (
                                         FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
                                         FID BIGINT DEFAULT 0 NOT NULL,
                                         FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
                                         FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);



/**End D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
