/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\LOG_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FUSERNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FUSERNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FBIZAPPNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FBIZAPPNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FBIZOBJNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FBIZOBJNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FORGNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FOPNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FOPNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FOPDESCRIPTION') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FOPDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_ARCHIVE' AND KSQL_COL_NAME ='FCLIENTNAME') 
 ALTER TABLE T_LOG_ARCHIVE ADD (FCLIENTNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FUSERNAME') 
 ALTER TABLE T_LOG_APP ADD (FUSERNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FBIZAPPNAME') 
 ALTER TABLE T_LOG_APP ADD (FBIZAPPNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FBIZOBJNAME') 
 ALTER TABLE T_LOG_APP ADD (FBIZOBJNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FORGNAME') 
 ALTER TABLE T_LOG_APP ADD (FORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FOPNAME') 
 ALTER TABLE T_LOG_APP ADD (FOPNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FOPDESCRIPTION') 
 ALTER TABLE T_LOG_APP ADD (FOPDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_LOG_APP' AND KSQL_COL_NAME ='FCLIENTNAME') 
 ALTER TABLE T_LOG_APP ADD (FCLIENTNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );

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