IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_QUERYDESIGN') 
CREATE TABLE T_FMM_QUERYDESIGN
(
	  FID             BIGINT        DEFAULT 0      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,    	
	  FISPUBLISH      CHAR(1)       DEFAULT '0'    NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_QUERYDESIGN_L') 
CREATE TABLE T_FMM_QUERYDESIGN_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_QUERYDESIGN_ENTRY') 
CREATE TABLE T_FMM_QUERYDESIGN_ENTRY
(
	  FID             BIGINT          DEFAULT 0     NOT NULL,         
	  FENTRYID        BIGINT          DEFAULT 0     NOT NULL,    
	  FSEQ            INT             DEFAULT 0     NOT NULL,            
	  FQUERYTYPE      NVARCHAR(5)     DEFAULT ' '   NOT NULL, 	
	  FBIZENTITY      NVARCHAR(255)   DEFAULT 0     NOT NULL, 	
	  FQUERYFIELD     NVARCHAR(50)    DEFAULT ' '   NOT NULL, 
	  FFIELDFLAG      NVARCHAR(50)    DEFAULT ' '   NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_QUERCARD_SETTING') 
CREATE TABLE T_FMM_QUERCARD_SETTING
(
	  FID             BIGINT          DEFAULT 0     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
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_QUERCARD_SETTING_L') 
CREATE TABLE T_FMM_QUERCARD_SETTING_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_QCS_ENTRY') 
CREATE TABLE T_FMM_QCS_ENTRY
(
	  FID              BIGINT          DEFAULT 0     NOT NULL,          	
	  FENTRYID         BIGINT          DEFAULT 0     NOT NULL,     	
	  FSEQ             INT             DEFAULT 0     NOT NULL,            
	  FLABELKEY        NVARCHAR(50)    DEFAULT ' '   NOT NULL, 	
	  FENTITYKEY       NVARCHAR(50)    DEFAULT ' '   NOT NULL, 	
	  FSHOWKEY         NVARCHAR(50)    DEFAULT ' '   NOT NULL, 
	  FCAPTION         NVARCHAR(50)    DEFAULT ' '   NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PROMONIT_MENUCONF')
 CREATE TABLE T_FMM_PROMONIT_MENUCONF 
(
		FID            BIGINT          DEFAULT 0     NOT NULL,       
		FCREATORID     BIGINT          DEFAULT 0     NOT NULL,       
		FMODIFIERID    BIGINT          DEFAULT 0     NOT NULL,      
		FMODIFYTIME    DATETIME,      
		FCREATETIME    DATETIME,       
		FSYSCONF       CHAR(1)         DEFAULT '0'   NOT NULL  
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FMM_PROMONIT_MENUS')
 CREATE TABLE T_FMM_PROMONIT_MENUS 
(
		FENTRYID        BIGINT          DEFAULT 0    NOT NULL,        
		FID             BIGINT          DEFAULT 0    NOT NULL,       
		FSEQ            INT             DEFAULT 0    NOT NULL,        
		FAPPID          NVARCHAR(50)    DEFAULT ' '  NOT NULL,       
		FMENUID         NVARCHAR(50)    DEFAULT ' '  NOT NULL,       
		FLAUNCHTYPE     NVARCHAR(50)    DEFAULT ' '  NOT NULL,        
		FPUBLISH        NVARCHAR(50)    DEFAULT ' '  NOT NULL
);







