/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MRP_table.sql **/



IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANPROGRAM' AND KSQL_COL_NAME ='FRADIOGROUP') 
 ALTER TABLE T_MRP_PLANPROGRAM ADD (FRADIOGROUP NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANPROGRAM' AND KSQL_COL_NAME ='FPLANTAG') 
 ALTER TABLE T_MRP_PLANPROGRAM ADD (FPLANTAG NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_PLANPENTRY') 
 CREATE TABLE T_MRP_PLANPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTYPENAME BIGINT DEFAULT 0 NOT NULL,
FELEMENTNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FELEMENTTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDEMANDENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDEMANDLOGO NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDEMANDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFRUNCONDITION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFRUNCONDITION_TAG NCLOB,
FPENTRYFRUNCONDITIONDESC NVARCHAR(255) DEFAULT ' ' NOT NULL
);




IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_STOCKSUPPLY' AND KSQL_COL_NAME ='FBODTIME') 
 ALTER TABLE T_MRP_STOCKSUPPLY ADD (FBODTIME INT DEFAULT 0 NOT NULL );



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