-- 全球费控配置
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_WORLDCONFIG')
CREATE TABLE T_ER_WORLDCONFIG (
                                  FID BIGINT DEFAULT 0 NOT NULL,
                                  FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
                                  FSTATUS VARCHAR(10) DEFAULT ' ' NOT NULL,
                                  FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                  FCREATORID BIGINT DEFAULT 0 NOT NULL,
                                  FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
                                  FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                  FCREATETIME DATETIME,
                                  FMODIFYTIME DATETIME,
                                  FMASTERID BIGINT DEFAULT 0 NOT NULL,
                                  FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
                                  FORGID BIGINT DEFAULT 0 NOT NULL,
                                  FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL,
                                  FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL,
                                  FBITINDEX BIGINT DEFAULT 0 NOT NULL,
                                  FSOURCEBITINDEX BIGINT DEFAULT 0 NOT NULL,
                                  FSRCCREATEORGID BIGINT DEFAULT 0 NOT NULL,
                                  FWITHHOLDINGTAX VARCHAR(10) DEFAULT ' ' NOT NULL,
                                  FCHECKWITHHOLDINGTAX VARCHAR(10) DEFAULT ' ' NOT NULL,
                                  FCALWITHHOLDINGTAX VARCHAR(10) DEFAULT ' ' NOT NULL,
                                  FWITHHOLDINGTAXDETAIL VARCHAR(10) DEFAULT ' ' NOT NULL
);

EXEC p_AlterPK 'PK_ER_WORLDCONFIG', 'T_ER_WORLDCONFIG', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_WORLDCONFIG' AND KSQL_INDNAME = 'IDX_ER_NUMBER')
CREATE INDEX IDX_ER_NUMBER ON T_ER_WORLDCONFIG (FNUMBER );






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

EXEC p_AlterPK 'PK_ER_WORLDCONFIG_L', 'T_ER_WORLDCONFIG_L', 'FPKID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_ER_WORLDCONFIG_L' AND KSQL_INDNAME = 'IDX_WORLDCONFIG_ID')
CREATE INDEX IDX_WORLDCONFIG_ID ON T_ER_WORLDCONFIG_L (FID ,FLOCALEID );




