/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MREQOUTBILLENTRY_L') 
 CREATE TABLE T_IM_MREQOUTBILLENTRY_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_PRODUCTINBILLENTRY_L') 
 CREATE TABLE T_IM_PRODUCTINBILLENTRY_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_MREQOUTBILLENTRY' AND KSQL_COL_NAME ='FPRODUCTID') 
 ALTER TABLE T_IM_MREQOUTBILLENTRY ADD (FPRODUCTID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MREQOUTBILLENTRY' AND KSQL_COL_NAME ='FPRODUCTNUM') 
 ALTER TABLE T_IM_MREQOUTBILLENTRY ADD (FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PRODUCTINBILLENTRY' AND KSQL_COL_NAME ='FPRODUCTNUM') 
 ALTER TABLE T_IM_PRODUCTINBILLENTRY ADD (FPRODUCTNUM NVARCHAR(255) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
