/**Begin D:\work\kuaijishijian\pdm\PDM_UPGRADE_1.4\PDM_UPGRADE\PDM1\AI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_INFO')
CREATE TABLE T_FAH_DIMGRP_INFO (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FDATABLOCKID BIGINT DEFAULT 0 NOT NULL,
                                   FDATABLOCKOFFSET SMALLINT DEFAULT 0 NOT NULL,
                                   FGRPVALHASH BIGINT DEFAULT 0 NOT NULL,
                                   FHASHFIX SMALLINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_VALUES')
CREATE TABLE T_FAH_DIMGRP_VALUES (
                                     FID BIGINT DEFAULT 0 NOT NULL,
                                     FDIMGRPTYPEID BIGINT DEFAULT 0 NOT NULL,
                                     FDATABLOCKID BIGINT DEFAULT 0 NOT NULL,
                                     FDIMCNT SMALLINT DEFAULT 0 NOT NULL,
                                     FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
                                     FREFCNT BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE1 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE2 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE3 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE4 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE5 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE6 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE7 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE8 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE9 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE10 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE11 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE12 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE13 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE14 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE15 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE16 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE17 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE18 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE19 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE20 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE21 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE22 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE23 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE24 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE25 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE26 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE27 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE28 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE29 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE30 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE31 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE32 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE33 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE34 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE35 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE36 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE37 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE38 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE39 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE40 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE41 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE42 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE43 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE44 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE45 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE46 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE47 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE48 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE49 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE50 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE51 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE52 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE53 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE54 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE55 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE56 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE57 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE58 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE59 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE60 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE61 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE62 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE63 BIGINT DEFAULT 0 NOT NULL,
                                     FIDVALUE64 BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_DIMGRP_VALUES_TMP')
CREATE TABLE T_FAH_DIMGRP_VALUES_TMP (
                                         FID BIGINT DEFAULT 0 NOT NULL,
                                         FDIMGRPTYPEID BIGINT DEFAULT 0 NOT NULL,
                                         FDIMCNT SMALLINT DEFAULT 0 NOT NULL,
                                         FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
                                         FGRPVALHASH BIGINT DEFAULT 0 NOT NULL,
                                         FMSG NCLOB,
                                         FTRANS_ID BIGINT DEFAULT 0 NOT NULL,
                                         FTRANS_BATCH_ID BIGINT DEFAULT 0 NOT NULL,
                                         FEVTLINEID BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE1 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE2 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE3 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE4 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE5 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE6 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE7 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE8 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE9 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE10 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE11 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE12 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE13 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE14 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE15 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE16 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE17 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE18 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE19 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE20 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE21 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE22 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE23 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE24 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE25 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE26 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE27 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE28 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE29 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE30 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE31 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE32 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE33 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE34 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE35 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE36 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE37 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE38 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE39 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE40 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE41 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE42 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE43 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE44 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE45 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE46 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE47 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE48 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE49 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE50 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE51 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE52 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE53 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE54 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE55 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE56 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE57 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE58 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE59 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE60 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE61 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE62 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE63 BIGINT DEFAULT 0 NOT NULL,
                                         FIDVALUE64 BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_AMT')
CREATE TABLE T_FAH_REG_DIMVAL_AMT (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FBIZDIMTYPEID BIGINT DEFAULT 0 NOT NULL,
                                      FDIMVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                      FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_DT')
CREATE TABLE T_FAH_REG_DIMVAL_DT (
                                     FID BIGINT DEFAULT 0 NOT NULL,
                                     FBIZDIMTYPEID BIGINT DEFAULT 0 NOT NULL,
                                     FDIMVALUE DATETIME,
                                     FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_REG_DIMVAL_TXT')
CREATE TABLE T_FAH_REG_DIMVAL_TXT (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FBIZDIMTYPEID BIGINT DEFAULT 0 NOT NULL,
                                      FDIMVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                      FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_AMT')
CREATE TABLE T_FAH_BLOCKIDX_AMT (
                                    FID BIGINT DEFAULT 0 NOT NULL,
                                    FDIMVALUE DECIMAL(23,10) DEFAULT 0 NOT NULL,
                                    FDIMTYPE BIGINT DEFAULT 0 NOT NULL,
                                    FDATABLOCKID INT DEFAULT 0 NOT NULL,
                                    FREFCNT BIGINT DEFAULT 0 NOT NULL,
                                    FSINGLEDIMGRPID BIGINT DEFAULT 0 NOT NULL,
                                    FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_AMT_MAP')
CREATE TABLE T_FAH_BLOCKIDX_AMT_MAP (
                                        FIDXGRPID BIGINT DEFAULT 0 NOT NULL,
                                        FDIMGRPID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_DT')
CREATE TABLE T_FAH_BLOCKIDX_DT (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FDIMVALUE DATETIME,
                                   FDIMTYPE BIGINT DEFAULT 0 NOT NULL,
                                   FDATABLOCKID INT DEFAULT 0 NOT NULL,
                                   FREFCNT BIGINT DEFAULT 0 NOT NULL,
                                   FSINGLEDIMGRPID BIGINT DEFAULT 0 NOT NULL,
                                   FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_DT_MAP')
CREATE TABLE T_FAH_BLOCKIDX_DT_MAP (
                                       FIDXGRPID BIGINT DEFAULT 0 NOT NULL,
                                       FDIMGRPID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_ID')
CREATE TABLE T_FAH_BLOCKIDX_ID (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FDIMVALUE BIGINT DEFAULT 0 NOT NULL,
                                   FDIMTYPE BIGINT DEFAULT 0 NOT NULL,
                                   FDATABLOCKID INT DEFAULT 0 NOT NULL,
                                   FREFCNT BIGINT DEFAULT 0 NOT NULL,
                                   FSINGLEDIMGRPID BIGINT DEFAULT 0 NOT NULL,
                                   FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_ID_MAP')
CREATE TABLE T_FAH_BLOCKIDX_ID_MAP (
                                       FIDXGRPID BIGINT DEFAULT 0 NOT NULL,
                                       FDIMGRPID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_TXT')
CREATE TABLE T_FAH_BLOCKIDX_TXT (
                                    FID BIGINT DEFAULT 0 NOT NULL,
                                    FDIMVALUE NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                    FDIMTYPE BIGINT DEFAULT 0 NOT NULL,
                                    FDATABLOCKID INT DEFAULT 0 NOT NULL,
                                    FREFCNT BIGINT DEFAULT 0 NOT NULL,
                                    FSINGLEDIMGRPID BIGINT DEFAULT 0 NOT NULL,
                                    FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_BLOCKIDX_TXT_MAP')
CREATE TABLE T_FAH_BLOCKIDX_TXT_MAP (
                                        FIDXGRPID BIGINT DEFAULT 0 NOT NULL,
                                        FDIMGRPID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FAH_DIM_INDEX_INFO')
CREATE TABLE T_FAH_DIM_INDEX_INFO (
                                      FID BIGINT DEFAULT 0 NOT NULL,
                                      FMAXDATABLOCK INT DEFAULT 0 NOT NULL,
                                      FMAXDATABLOCKOFFSET INT DEFAULT 0 NOT NULL,
                                      FMAXDATASEGMENT INT DEFAULT 0 NOT NULL,
                                      FMAXDATASEGOFFSET INT DEFAULT 0 NOT NULL
);



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