/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FAREA') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FAREA BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FCONTROLNO') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FCONTROLNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FTARNO') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FTARNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FAPPENDIXNO') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FAPPENDIXNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FISSHORTAGE') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FISSHORTAGE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FISFIRSTEXE') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FISFIRSTEXE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FISOMEXE') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FISOMEXE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FISOMTOOL') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FISOMTOOL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FSWSPAGENO') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FSWSPAGENO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FREASONOFERROR') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FREASONOFERROR NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY_E' AND KSQL_COL_NAME ='FPLANDAYS') 
 ALTER TABLE T_POM_MROORDERENTRY_E ADD (FPLANDAYS BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROORDERENTRY' AND KSQL_COL_NAME ='FMODIFYSTATUSTIME') 
 ALTER TABLE T_POM_MROORDERENTRY ADD (FMODIFYSTATUSTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_TRANSTYPECODERULE_L') 
 CREATE TABLE T_POM_TRANSTYPECODERULE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROCODERULESEQ') 
 CREATE TABLE T_POM_MROCODERULESEQ (
FPROJECTKEYS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCHAR VARCHAR(20) DEFAULT ' ' NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROINTERRUPTNO') 
 CREATE TABLE T_POM_MROINTERRUPTNO (
FPROJECTKEYS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCHAR VARCHAR(20) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL
);
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\POM_table.sql **/