/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MAL_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDER_JD' AND KSQL_COL_NAME ='FCURRID') 
 ALTER TABLE T_MAL_ORDER_JD ADD (FCURRID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDER_SN' AND KSQL_COL_NAME ='FCURRID') 
 ALTER TABLE T_MAL_ORDER_SN ADD (FCURRID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_EAFSERVENTRY' AND KSQL_COL_NAME ='FSEQ') 
 ALTER TABLE T_MAL_EAFSERVENTRY ADD (FSEQ BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDERENTRY_A' AND KSQL_COL_NAME ='FORDER') 
 ALTER TABLE T_MAL_ORDERENTRY_A ADD (FORDER BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDER_A' AND KSQL_COL_NAME ='FECSOURCE') 
 ALTER TABLE T_MAL_ORDER_A ADD (FECSOURCE NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDER_A' AND KSQL_COL_NAME ='FECORDERID') 
 ALTER TABLE T_MAL_ORDER_A ADD (FECORDERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_ORDER_A' AND KSQL_COL_NAME ='FECORDERSTATUS') 
 ALTER TABLE T_MAL_ORDER_A ADD (FECORDERSTATUS CHAR(1) DEFAULT ' ' NOT NULL );

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