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



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