/**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_PLANORDER' AND KSQL_COL_NAME ='FDEMANDTYPE') 
 ALTER TABLE T_MRP_PLANORDER ADD (FDEMANDTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 -- 计划订单新增需求单据ID字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANORDER' AND KSQL_COL_NAME ='FDEMANDBILLID') 
 ALTER TABLE T_MRP_PLANORDER ADD (FDEMANDBILLID NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 -- 计划订单新增需求单据编号字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANORDER' AND KSQL_COL_NAME ='FDEMANDBILL') 
 ALTER TABLE T_MRP_PLANORDER ADD (FDEMANDBILL NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 -- 计划订单新增需求单据行号字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANORDER' AND KSQL_COL_NAME ='FDEMANDSEQ') 
 ALTER TABLE T_MRP_PLANORDER ADD (FDEMANDSEQ INT DEFAULT 0 NOT NULL );
 
 -- 计划订单新增需求单据分录ID字段
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MRP_PLANORDER' AND KSQL_COL_NAME ='FDEMANDBILLENTRYID') 
 ALTER TABLE T_MRP_PLANORDER ADD (FDEMANDBILLENTRYID NVARCHAR(50) DEFAULT ' ' NOT NULL );

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