/**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_MFTORDERREPORT' AND KSQL_COL_NAME ='FSRCTYPE') 
 ALTER TABLE T_POM_MFTORDERREPORT ADD (FSRCTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_POM_MROLOCKENTRY') 
 CREATE TABLE T_POM_MROLOCKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FLOCKID BIGINT DEFAULT 0 NOT NULL,
FLOCKPOS NVARCHAR(80) DEFAULT ' ' NOT NULL,
FENTBIZSTATUS NVARCHAR(5) DEFAULT ' ' NOT NULL,
FENTREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL,
FENTBORROWER BIGINT DEFAULT 0 NOT NULL,
FENTTAGCOUNT BIGINT DEFAULT 0 NOT NULL,
FTAGCDESC NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTCREATER BIGINT DEFAULT 0 NOT NULL,
FENTINDUSTRY NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROL' AND KSQL_COL_NAME ='FBORROWQTY') 
 ALTER TABLE T_POM_MROLOCKCONTROL ADD (FBORROWQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROL' AND KSQL_COL_NAME ='FUNITID') 
 ALTER TABLE T_POM_MROLOCKCONTROL ADD (FUNITID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROL' AND KSQL_COL_NAME ='FRETURNQTY') 
 ALTER TABLE T_POM_MROLOCKCONTROL ADD (FRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROL' AND KSQL_COL_NAME ='FNOTRETURNQTY') 
 ALTER TABLE T_POM_MROLOCKCONTROL ADD (FNOTRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROL' AND KSQL_COL_NAME ='FNOTREMOVEQTY') 
 ALTER TABLE T_POM_MROLOCKCONTROL ADD (FNOTREMOVEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_POM_MROLOCKCONTROLENTRY' AND KSQL_COL_NAME ='FDETAILID') 
 ALTER TABLE T_POM_MROLOCKCONTROLENTRY ADD (FDETAILID BIGINT DEFAULT 0 NOT NULL );


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