/**Begin D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGTEAM' AND KSQL_COL_NAME IN ('FSORTCODE')) 
 ALTER TABLE T_HAOS_ORGTEAM ADD (FSORTCODE VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGTEAM' AND KSQL_COL_NAME IN ('FSTRUCTLONGNUMBER')) 
 ALTER TABLE T_HAOS_ORGTEAM ADD (FSTRUCTLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGTEAM' AND KSQL_COL_NAME IN ('FLEVEL')) 
 ALTER TABLE T_HAOS_ORGTEAM ADD (FLEVEL INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORG' AND KSQL_COL_NAME IN ('FSORTCODE')) 
 ALTER TABLE T_HAOS_ADMINORG ADD (FSORTCODE VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORG' AND KSQL_COL_NAME IN ('FSTRUCTLONGNUMBER')) 
 ALTER TABLE T_HAOS_ADMINORG ADD (FSTRUCTLONGNUMBER VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORG' AND KSQL_COL_NAME IN ('FLEVEL')) 
 ALTER TABLE T_HAOS_ADMINORG ADD (FLEVEL INT DEFAULT 0 NOT NULL );

/**End D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/