IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_INITRESSULTENTRY') 
 CREATE TABLE T_MAL_INITRESSULTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_INITRESULT') 
 CREATE TABLE T_MAL_INITRESULT (
FID BIGINT DEFAULT 0 NOT NULL,
FEMALAUTHID BIGINT DEFAULT 0 NOT NULL,
FISPASS CHAR(1) DEFAULT ' ' NOT NULL,
FTIMECOST BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FCURRENCYID') 
 ALTER TABLE T_MAL_ECADMIT ADD (FCURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FMESUREUNITSID') 
 ALTER TABLE T_MAL_ECADMIT ADD (FMESUREUNITSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FMALSUPPLIERID') 
 ALTER TABLE T_MAL_ECADMIT ADD (FMALSUPPLIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FEMALEMAIL') 
 ALTER TABLE T_MAL_ECADMIT ADD (FEMALEMAIL VARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FINVOICETYPEID') 
 ALTER TABLE T_MAL_ECADMIT ADD (FINVOICETYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FPAYTYPEID') 
 ALTER TABLE T_MAL_ECADMIT ADD (FPAYTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ECADMIT' AND KSQL_COL_NAME ='FOPENSTATUS') 
 ALTER TABLE T_MAL_ECADMIT ADD (FOPENSTATUS CHAR(1) DEFAULT ' ' NOT NULL );
