/**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_R' AND KSQL_COL_NAME ='FSRCSYSTEM') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY_R ADD (FSRCSYSTEM NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY_R' AND KSQL_COL_NAME ='FSRCSYSBILLID') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY_R ADD (FSRCSYSBILLID NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY_R' AND KSQL_COL_NAME ='FSRCSYSBILLENTRYID') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY_R ADD (FSRCSYSBILLENTRYID NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICEENTRY_R' AND KSQL_COL_NAME ='FSRCSYSBILLNO') 
 ALTER TABLE T_SM_DELIVERNOTICEENTRY_R ADD (FSRCSYSBILLNO NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICE' AND KSQL_COL_NAME ='FISVIRTUALBILL') 
 ALTER TABLE T_SM_DELIVERNOTICE ADD (FISVIRTUALBILL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICE' AND KSQL_COL_NAME ='FTRANSACTEPATHID') 
 ALTER TABLE T_SM_DELIVERNOTICE ADD (FTRANSACTEPATHID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SM_DELIVERNOTICE' AND KSQL_COL_NAME ='FASYNCSTATUS') 
 ALTER TABLE T_SM_DELIVERNOTICE ADD (FASYNCSTATUS CHAR(1) DEFAULT 'B' NOT NULL );

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