/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_AE_HEADERS' AND KSQL_COL_NAME ='FNUMBER')
ALTER TABLE T_FAH_AE_HEADERS ADD (FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_AE_HEADERS' AND KSQL_COL_NAME ='FSTATUS')
ALTER TABLE T_FAH_AE_HEADERS ADD (FSTATUS CHAR(1) DEFAULT '4' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_AE_HEADERS_TMP' AND KSQL_COL_NAME ='FNUMBER')
ALTER TABLE T_FAH_AE_HEADERS_TMP ADD (FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_AE_HEADERS_TMP' AND KSQL_COL_NAME ='FSTATUS')
ALTER TABLE T_FAH_AE_HEADERS_TMP ADD (FSTATUS CHAR(1) DEFAULT '4' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_ACCT_SEQ')
CREATE TABLE T_FAH_ACCT_SEQ (
                                FID BIGINT DEFAULT 0 NOT NULL,
                                FSEQ INT DEFAULT 0 NOT NULL,
                                FORGNUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
                                FACCTPURPNUM VARCHAR(30) DEFAULT ' ' NOT NULL,
                                FPERIODNUM VARCHAR(80) DEFAULT ' ' NOT NULL,
                                FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_EVENT_HEADER' AND KSQL_COL_NAME ='FSTATUS')
ALTER TABLE T_FAH_EVENT_HEADER ADD (FSTATUS CHAR(1) DEFAULT '4' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_VOUCHER_IF' AND KSQL_COL_NAME ='FSTATUS')
ALTER TABLE T_FAH_VOUCHER_IF ADD (FSTATUS CHAR(1) DEFAULT '4' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FAH_EVT_TRACKER' AND KSQL_COL_NAME ='FSTATUS')
ALTER TABLE T_FAH_EVT_TRACKER ADD (FSTATUS CHAR(1) DEFAULT '4' NOT NULL );

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