
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_MQBENTRY_L')
 CREATE TABLE T_IM_MDC_MQBENTRY_L (
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MDC_PRBLENTRY_L')
 CREATE TABLE T_IM_MDC_PRBLENTRY_L (
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_MQBENTRY' AND KSQL_COL_NAME ='FPRODUCTID')
 ALTER TABLE T_IM_MDC_MQBENTRY ADD (FPRODUCTID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_MQBENTRY' AND KSQL_COL_NAME ='FPRODUCTNUM')
 ALTER TABLE T_IM_MDC_MQBENTRY ADD (FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL );


  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MDC_PRBLENTRY' AND KSQL_COL_NAME ='FPRODUCTNUM')
 ALTER TABLE T_IM_MDC_PRBLENTRY ADD (FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL );



