/*==============================================================*/
/* Table: T_EB_MemberMapping                                    */
/*==============================================================*/
/* 处理表结构变更 */
if exists (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FBASEDATAFIELD')) 
drop table T_EB_MEMBERMAPPING;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MEMBERMAPPING') 
CREATE TABLE T_EB_MEMBERMAPPING (
   FID                  BIGINT               NOT NULL DEFAULT 0,
   FENTRYID             BIGINT               NOT NULL DEFAULT 0,
   FSEQ                 INT                  NOT NULL DEFAULT 0,
   FBIZMEMBERID       	BIGINT               NOT NULL DEFAULT 0,
   FBINUMBER	      	NVARCHAR(100)        NOT NULL DEFAULT ' ',
   FBIZNAME           	NVARCHAR(100)        NOT NULL DEFAULT ' ',
   FDIMMEMBERID			BIGINT  	     	 NOT NULL DEFAULT 0,
   FDIMMEMNUMBER      	NVARCHAR(100)        NOT NULL DEFAULT ' ',
   FDIMMEMNAME    		NVARCHAR(100)        NOT NULL DEFAULT ' ',
   FENTRYSTATUS         CHAR(1)              NOT NULL DEFAULT '1'
);
 EXEC P_ALTERPK 'PK_T_EB_MEMBERMAPPING', 'T_EB_MEMBERMAPPING', 'FENTRYID', '1';

/*==============================================================*/
/* Index: IDX_EB_membermapping_weidu                            */
/*==============================================================*/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_MEMBERMAPPING_WEIDU')
CREATE INDEX IDX_EB_MEMBERMAPPING_WEIDU ON T_EB_MEMBERMAPPING (
FDIMMEMNUMBER ASC
);