IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMBD_CALENDAR') 
CREATE TABLE T_PMBD_CALENDAR
(
  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, 	
  FISDEFALT CHAR(1) DEFAULT '0' NOT NULL, 	
  FEXPIRSTARTDATE DATETIME ,              
  FEXPIRENDATE DATETIME ,                 
  FMONDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FTUESDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FWEDNESDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FTHURSDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FFRIDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FSATURDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FSUNDAYRADIO NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FHOURYEAR DECIMAL(23,10) DEFAULT 0 NOT NULL, 	
  FHOURMONTH DECIMAL(23,10) DEFAULT 0 NOT NULL, 	
  FHOURWEEKEND DECIMAL(23,10) DEFAULT 0 NOT NULL, 
  FHOURDAY DECIMAL(23,10) DEFAULT 0 NOT NULL, 	
  FAUDITORID BIGINT DEFAULT 0 NOT NULL,   
  FAUDITTIME DATETIME                    	
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMBD_CALENDAR_L') 
CREATE TABLE T_PMBD_CALENDAR_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_PMBD_HALFWORKTIME') 
CREATE TABLE T_PMBD_HALFWORKTIME
(
  FID BIGINT DEFAULT 0 NOT NULL,        
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     
  FSEQ INT DEFAULT 0 NOT NULL,            
  FHALFWORKSTARTTIME INT DEFAULT 0 NOT NULL, 	
  FHALFWORKFINSHTIME INT DEFAULT 0 NOT NULL 	
);

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





