/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_ORNEEDPLAN' AND KSQL_COL_NAME ='FISSPEC') 
 ALTER TABLE T_MSPLAN_ORNEEDPLAN ADD (FISSPEC CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLAN' AND KSQL_COL_NAME ='FECNSTATUS') 
 ALTER TABLE T_MSPLAN_EQNEEDPLAN ADD (FECNSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FSOURCETYPE NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FUSETIME') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FUSETIME DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FPLANTIME') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FPLANTIME DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FAREA') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FAREA NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FPGRES') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FPGRES VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FDELIVETIME') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FDELIVETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FQUITTIME') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FQUITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FISQUIT') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FISQUIT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQNEEDPLANENTRY' AND KSQL_COL_NAME ='FISDELIVE') 
 ALTER TABLE T_MSPLAN_EQNEEDPLANENTRY ADD (FISDELIVE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLAN' AND KSQL_COL_NAME ='FECNSTATUS') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLAN ADD (FECNSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLAN' AND KSQL_COL_NAME ='FECNREMARK') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLAN ADD (FECNREMARK NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FSOURCETYPE') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FSOURCETYPE NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FUSETIME') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FUSETIME DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FPLANTIME') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FPLANTIME DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FAREA') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FAREA NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FPGRES') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FPGRES VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FDELIVETIME') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FDELIVETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FQUITTIME') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FQUITTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FISQUIT') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FISQUIT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_EQXNEEDPLANENTRY' AND KSQL_COL_NAME ='FISDELIVE') 
 ALTER TABLE T_MSPLAN_EQXNEEDPLANENTRY ADD (FISDELIVE CHAR(1) DEFAULT '0' NOT NULL );

/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
