
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_MILE_PHAS')
CREATE TABLE T_FMM_MILE_PHAS
(
	  FID                     BIGINT             DEFAULT 0     NOT NULL,          
	  FNUMBER                 NVARCHAR(30)       DEFAULT ' '   NOT NULL, 	
	  FNAME                   NVARCHAR(50)       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,      
	  FUSEORGID               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, 	
	  FPOSTMILEPOSTNODEID     BIGINT             DEFAULT 0     NOT NULL, 	
	  FPROJECTPHASEID         BIGINT             DEFAULT 0     NOT NULL, 	
	  FPREMILEPOSTNODEID      BIGINT             DEFAULT 0     NOT NULL, 	
	  FPRIORITY               INT                DEFAULT 0     NOT NULL,      
	  FREMARK                 NVARCHAR(50)       DEFAULT ' '   NOT NULL, 	
	  FAUDITOR                BIGINT             DEFAULT 0     NOT NULL,     
	  FAUDITDATE              DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_MILE_PHAS_L')
CREATE TABLE T_FMM_MILE_PHAS_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_PLANAREAWA')
CREATE TABLE T_FMM_PLANAREAWA
(
	  FID                     BIGINT              DEFAULT 0    NOT NULL,          	
	  FNUMBER                 NVARCHAR(30)        DEFAULT ' '  NOT NULL, 	
	  FNAME                   NVARCHAR(50)        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,       
	  FUSEORGID               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, 	
	  FPLANNINGAREAID         BIGINT              DEFAULT 0    NOT NULL, 	
	  FREMARK                 NVARCHAR(50)        DEFAULT ' '  NOT NULL, 
	  FAUDITOR                BIGINT              DEFAULT 0    NOT NULL,     
	  FAUDITDATE              DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PLANAREAWA_L')
CREATE TABLE T_FMM_PLANAREAWA_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_MPDMAREA_D')
CREATE TABLE T_FMM_MPDMAREA_D
(
	  FID                     BIGINT              DEFAULT 0    NOT NULL,          
	  FENTRYID                BIGINT              DEFAULT 0    NOT NULL,   
	  FSEQ                    INT                 DEFAULT 0    NOT NULL,            	
	  FMPDMAREAID             BIGINT              DEFAULT 0    NOT NULL,  
	  FDESCRIBE               NVARCHAR(50)        DEFAULT ' '  NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PLANNINGAREA')
CREATE TABLE T_FMM_PLANNINGAREA
(
	  FID                     BIGINT              DEFAULT 0    NOT NULL,         
	  FNUMBER                 NVARCHAR(30)        DEFAULT ' '  NOT NULL, 
	  FNAME                   NVARCHAR(50)        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,      
	  FUSEORGID               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, 	
	  FREMARK                 NVARCHAR(50)        DEFAULT ' '  NOT NULL, 
	  FAUDITOR                BIGINT              DEFAULT 0    NOT NULL,     
	  FAUDITDATE              DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PLANNINGAREA_L')
CREATE TABLE T_FMM_PLANNINGAREA_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_PROPGGROUP')
CREATE TABLE T_FMM_PROPGGROUP
(
	  FID                     BIGINT              DEFAULT 0     NOT NULL,          
	  FNUMBER                 NVARCHAR(30)        DEFAULT ' '   NOT NULL, 
	  FNAME                   NVARCHAR(50)        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,       
	  FUSEORGID               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, 	
	  FPROJECTPHASEID         BIGINT              DEFAULT 0     NOT NULL, 
	  FREMARK                 NVARCHAR(50)        DEFAULT ' '   NOT NULL,
	  FAUDITOR                BIGINT              DEFAULT 0     NOT NULL,    
	  FAUDITDATE              DATETIME
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PROPGGROUP_L')
CREATE TABLE T_FMM_PROPGGROUP_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_OPTGROUPD')
CREATE TABLE T_FMM_OPTGROUPD
(
	  FID                     BIGINT              DEFAULT 0     NOT NULL,          
	  FENTRYID                BIGINT              DEFAULT 0     NOT NULL,     
	  FSEQ                    INT                 DEFAULT 0     NOT NULL,            
	  FPROCESSGROUPID         BIGINT              DEFAULT 0     NOT NULL, 	
	  FDESCRIBE               NVARCHAR(50)        DEFAULT ' '   NOT NULL
);










