IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_CORETEAM') 
CREATE TABLE T_FMM_CORETEAM
(
  FID               BIGINT          DEFAULT 0       NOT NULL,    
  FNAME             NVARCHAR(50)    DEFAULT ' '     NOT NULL,  
  FNUMBER           NVARCHAR(30)    DEFAULT ' '     NOT NULL, 	
  FSTATUS           NVARCHAR(1)     DEFAULT ' '     NOT NULL, 	
  FCREATORID        BIGINT          DEFAULT 0       NOT NULL,   	
  FMODIFIERID       BIGINT          DEFAULT 0       NOT NULL,  	
  FENABLE           NVARCHAR(1)     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     NVARCHAR(5)     DEFAULT ' '     NOT NULL, 	
  FSOURCEDATAID     BIGINT          DEFAULT 0       NOT NULL, 	
  FBITINDEX         INT             DEFAULT 0       NOT NULL,       	
  FSOURCEBITINDEX   INT             DEFAULT 0       NOT NULL, 	
  FCUSTOMERID       BIGINT          DEFAULT 0       NOT NULL,  	
  FAUDITORID        BIGINT          DEFAULT 0       NOT NULL,   	
  FAUDITTIME        DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_CORETEAMPENTRY') 
CREATE TABLE T_FMM_CORETEAMPENTRY
(
  FID               BIGINT            DEFAULT 0      NOT NULL,          
  FENTRYID          BIGINT            DEFAULT 0      NOT NULL,     	
  FSEQ              INT               DEFAULT 0      NOT NULL, 
  FPERSONNELID      BIGINT            DEFAULT 0      NOT NULL, 	
  FISBIZINCHARGE    CHAR(1)           DEFAULT '0'    NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_CORETEAMCENTRY') 
CREATE TABLE T_FMM_CORETEAMCENTRY
(
  FID               BIGINT             DEFAULT 0     NOT NULL,         
  FENTRYID          BIGINT             DEFAULT 0     NOT NULL,    
  FSEQ              INT                DEFAULT 0     NOT NULL,           
  FCLASSGROUP       BIGINT             DEFAULT 0     NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_POSITION') 
CREATE TABLE T_FMM_POSITION
(
  FID               BIGINT             DEFAULT 0     NOT NULL,   
  FNAME             NVARCHAR(50)       DEFAULT ' '   NOT NULL,  
  FNUMBER           NVARCHAR(30)       DEFAULT ' '   NOT NULL, 	
  FSTATUS           NVARCHAR(1)        DEFAULT ' '   NOT NULL, 	
  FCREATORID        BIGINT             DEFAULT 0     NOT NULL,   	
  FMODIFIERID       BIGINT             DEFAULT 0     NOT NULL,  	
  FENABLE           NVARCHAR(1)        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     NVARCHAR(5)        DEFAULT ' '   NOT NULL, 	
  FSOURCEDATAID     BIGINT             DEFAULT 0     NOT NULL, 	
  FBITINDEX         INT                DEFAULT 0     NOT NULL,       	
  FSOURCEBITINDEX   INT                DEFAULT 0     NOT NULL, 	
  FAUDITORID        BIGINT             DEFAULT 0     NOT NULL,   	
  FAUDITTIME        DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_POSITIONTYPE') 
CREATE TABLE T_FMM_POSITIONTYPE
(
  FID               BIGINT             DEFAULT 0     NOT NULL,  
  FNAME             NVARCHAR(50)       DEFAULT ' '   NOT NULL, 
  FNUMBER           NVARCHAR(30)       DEFAULT ' '   NOT NULL, 	
  FSTATUS           NVARCHAR(1)        DEFAULT ' '   NOT NULL, 
  FCREATORID        BIGINT             DEFAULT 0     NOT NULL,   	
  FMODIFIERID       BIGINT             DEFAULT 0     NOT NULL,  	
  FENABLE           NVARCHAR(1)        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     NVARCHAR(5)        DEFAULT ' '   NOT NULL, 	
  FSOURCEDATAID     BIGINT             DEFAULT 0     NOT NULL, 	
  FBITINDEX         INT                DEFAULT 0     NOT NULL,       
  FSOURCEBITINDEX   INT                DEFAULT 0     NOT NULL, 	
  FAUDITORID        BIGINT             DEFAULT 0     NOT NULL,   
  FAUDITTIME        DATETIME
);


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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_POST') 
CREATE TABLE T_FMM_POST
(
  FID               BIGINT             DEFAULT 0     NOT NULL,   
  FNAME             NVARCHAR(50)       DEFAULT ' '   NOT NULL,  
  FNUMBER           NVARCHAR(30)       DEFAULT ' '   NOT NULL, 
  FSTATUS           NVARCHAR(1)        DEFAULT ' '   NOT NULL, 	
  FCREATORID        BIGINT             DEFAULT 0     NOT NULL,   	
  FMODIFIERID       BIGINT             DEFAULT 0     NOT NULL,  	
  FENABLE           NVARCHAR(1)        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     NVARCHAR(5)        DEFAULT ' '   NOT NULL, 	
  FSOURCEDATAID     BIGINT             DEFAULT 0     NOT NULL, 	
  FBITINDEX         INT                DEFAULT 0     NOT NULL,       
  FSOURCEBITINDEX   INT                DEFAULT 0     NOT NULL, 	
  FPOSTTYPEID       BIGINT             DEFAULT 0     NOT NULL,  
  FPROFESSIONALID   BIGINT             DEFAULT 0     NOT NULL, 	
  FPOSITIONTYPEID   BIGINT             DEFAULT 0     NOT NULL, 	
  FAUTHORIZELEVELID BIGINT             DEFAULT 0     NOT NULL, 	
  FAUDITORID        BIGINT             DEFAULT 0     NOT NULL,   	
  FAUDITTIME        DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_POSTTYPE') 
CREATE TABLE T_FMM_POSTTYPE
(
  FID              BIGINT               DEFAULT 0     NOT NULL,   
  FNAME            NVARCHAR(50)         DEFAULT ' '   NOT NULL,  
  FNUMBER          NVARCHAR(30)         DEFAULT ' '   NOT NULL, 	
  FSTATUS          NVARCHAR(1)          DEFAULT ' '   NOT NULL, 
  FCREATORID       BIGINT               DEFAULT 0     NOT NULL,   
  FMODIFIERID      BIGINT               DEFAULT 0     NOT NULL,  	
  FENABLE          NVARCHAR(1)          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    NVARCHAR(5)          DEFAULT ' '   NOT NULL, 	
  FSOURCEDATAID    BIGINT               DEFAULT 0     NOT NULL, 	
  FBITINDEX        INT                  DEFAULT 0     NOT NULL,       	
  FSOURCEBITINDEX  INT                  DEFAULT 0     NOT NULL, 	
  FDESC            NVARCHAR(500)        DEFAULT ' '   NOT NULL, 
  FAUDITORID       BIGINT               DEFAULT 0     NOT NULL,   
  FAUDITTIME       DATETIME
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_RANK') 
CREATE TABLE T_FMM_RANK
(
  FID              BIGINT                DEFAULT 0     NOT NULL,    
  FNAME            NVARCHAR(50)          DEFAULT ' '   NOT NULL, 
  FNUMBER          NVARCHAR(30)          DEFAULT ' '   NOT NULL, 	
  FSTATUS          NVARCHAR(1)           DEFAULT ' '   NOT NULL, 	
  FCREATORID       BIGINT                DEFAULT 0     NOT NULL,   	
  FMODIFIERID      BIGINT                DEFAULT 0     NOT NULL,  
  FENABLE          NVARCHAR(1)           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    NVARCHAR(5)           DEFAULT ' '   NOT NULL, 	
  FSOURCEDATAID    BIGINT                DEFAULT 0     NOT NULL, 	
  FBITINDEX        INT                   DEFAULT 0     NOT NULL,       	
  FSOURCEBITINDEX  INT                   DEFAULT 0     NOT NULL, 	
  FAUDITORID       BIGINT                DEFAULT 0     NOT NULL,   
  FAUDITTIME       DATETIME
);


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













