/**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_CALDETAILENTRY_E' AND KSQL_COL_NAME ='FPLANTAG') 
 ALTER TABLE T_MRP_CALDETAILENTRY_E ADD (FPLANTAG NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PURFORECASTENTRY' AND KSQL_COL_NAME ='FPLANTAG') 
 ALTER TABLE T_MRP_PURFORECASTENTRY ADD (FPLANTAG CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FISTOCK') 
 ALTER TABLE T_MRP_INHENTRY ADD (FISTOCK NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FYIELD') 
 ALTER TABLE T_MRP_INHENTRY ADD (FYIELD DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FSTOCKID') 
 ALTER TABLE T_MRP_INHENTRY ADD (FSTOCKID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FSTOCKINDEXID') 
 ALTER TABLE T_MRP_INHENTRY ADD (FSTOCKINDEXID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FSTOCKTYPEID') 
 ALTER TABLE T_MRP_INHENTRY ADD (FSTOCKTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FSTOCKSTATUSID') 
 ALTER TABLE T_MRP_INHENTRY ADD (FSTOCKSTATUSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FWAREHOUSENAME') 
 ALTER TABLE T_MRP_INHENTRY ADD (FWAREHOUSENAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FLOCATIONNAME') 
 ALTER TABLE T_MRP_INHENTRY ADD (FLOCATIONNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_INHENTRY' AND KSQL_COL_NAME ='FSUPPLYORGNAME') 
 ALTER TABLE T_MRP_INHENTRY ADD (FSUPPLYORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_OPTION_PERCENT') 
 CREATE TABLE T_MRP_OPTION_PERCENT (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FAUDITDATE DATETIME,
FOPTION_ITEM BIGINT DEFAULT 0 NOT NULL,
FPURPLAN BIGINT DEFAULT 0 NOT NULL,
FPBOM BIGINT DEFAULT 0 NOT NULL,
FPRODUCT_FAMILY BIGINT DEFAULT 0 NOT NULL,
FPRODUCT_DOMAIN BIGINT DEFAULT 0 NOT NULL,
FPRODUCT_LINE BIGINT DEFAULT 0 NOT NULL,
FRELEASE_STATUS NVARCHAR(20) DEFAULT ' ' NOT NULL,
FPRODUCT_MODEL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMAX_QTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMIN_QTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTY_ADJUST DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT BIGINT DEFAULT 0 NOT NULL,
FDATE DATETIME,
FTYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FDELIVERY_TIME DECIMAL(23,10) DEFAULT 0 NOT NULL,
FADD_RATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MRP_BFTRANSFERMDS') 
 CREATE TABLE T_MRP_BFTRANSFERMDS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PRODFORECAST' AND KSQL_COL_NAME ='FAREA') 
 ALTER TABLE T_MRP_PRODFORECAST ADD (FAREA NVARCHAR(50) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_MRP_BOMEXPANDENTRY', 'FMATERIALATTR', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_MRP_BOMEXPANDENTRY', 'FISOLATEDRULE', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_MRP_BOMEXPANDENTRY', 'FBILLSTATUS', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FBOMVERSION') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FBOMVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEVERSION') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEVERSION NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEPROORG') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEPROORG BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULESUPPLYORG') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULESUPPLYORG BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FCOMBOXMATERIALATTR') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FCOMBOXMATERIALATTR NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FECNVERSION') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FECNVERSION BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEECNVERSION') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEECNVERSION BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMANUPERIOD') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMANUPERIOD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FUNIT') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FUNIT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEUNIT') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEUNIT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULETYPE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULENUMERATOR') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULENUMERATOR DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEDENOMINATOR') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEDENOMINATOR DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULELOSS') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULELOSS DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULEWASTE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULEWASTE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULECUSTYPE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULECUSTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FMODULESUPPLYTYPE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FMODULESUPPLYTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FREPLACEPLANID') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FREPLACEPLANID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FISREPLACEPLANMM') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FISREPLACEPLANMM CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FISREPLACE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FISREPLACE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FENTRYPRIORITY') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FENTRYPRIORITY BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FREPLACESTRA') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FREPLACESTRA NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FREPLACEMETHOD') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FREPLACEMETHOD NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FVALIDDATE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FVALIDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FINVALIDDATE') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FINVALIDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FCTRLSTRATEGY') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FCTRLSTRATEGY NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FISPASSREQ') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FISPASSREQ CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FISJUMP') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FISJUMP CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_BOMEXPANDENTRY' AND KSQL_COL_NAME ='FCOMBOXMATERIEL') 
 ALTER TABLE T_MRP_BOMEXPANDENTRY ADD (FCOMBOXMATERIEL BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_MRP_DEMANDBILLENTRY', 'FMATERIALATTR', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_MRP_DEMANDBILLENTRY', 'FISOLATEDRULE', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_MRP_DEMANDBILLENTRY', 'FBILLSTATUS', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FISTOCK') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FISTOCK CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FISDEMAND') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FISDEMAND CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FECNVERSION') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FECNVERSION BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FDEMANDSOURCETYPE') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FDEMANDSOURCETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FMATERIALNAME') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FMATERIALNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FMATERIALNUMBER') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FMATERIALNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FPRODUCTORGNAME') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FPRODUCTORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FPRODUCTORGNUMBER') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FPRODUCTORGNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FMDSDEMANDTYPE') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FMDSDEMANDTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FINVALIDDATE') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FINVALIDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FSAFEINVDAYS') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FSAFEINVDAYS BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_DEMANDBILLENTRY' AND KSQL_COL_NAME ='FSAFEINVTYPE') 
 ALTER TABLE T_MRP_DEMANDBILLENTRY ADD (FSAFEINVTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
 --- drop column --------- 不允许删除表T_MRP_DEMANDBILLENTRY的字段FPURCHASEORGUNITID，请恢复pdm中的字段 ------------------- 

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