/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FISCONTROLQTY') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FISCONTROLQTY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERRATEDOWN') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERRATEDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERRATEUP') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERRATEUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYUP') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERBASEQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYDOWN') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERBASEQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERQTYUP') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY' AND KSQL_COL_NAME ='FDELIVERQTYDOWN') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY ADD (FDELIVERQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FISCONTROLQTY') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FISCONTROLQTY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERRATEDOWN') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERRATEDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERRATEUP') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERRATEUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYUP') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERBASEQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYDOWN') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERBASEQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERQTYUP') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_XSALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERQTYDOWN') 
 ALTER TABLE T_SM_XSALORDERENTRY ADD (FDELIVERQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FISCONTROLQTY') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FISCONTROLQTY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERRATEDOWN') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERRATEDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERRATEUP') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERRATEUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYUP') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERBASEQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERBASEQTYDOWN') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERBASEQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERQTYUP') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERQTYUP DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_SALORDERENTRY' AND KSQL_COL_NAME ='FDELIVERQTYDOWN') 
 ALTER TABLE T_SM_SALORDERENTRY ADD (FDELIVERQTYDOWN DECIMAL(23,10) DEFAULT 0 NOT NULL );

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