/**Begin D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FORINUMBER')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPESTD' AND KSQL_COL_NAME IN ('FORINUMBER')) 
 ALTER TABLE T_HAOS_ADMINORGTYPESTD ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPESTD' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_ADMINORGTYPESTD ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPESTD' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_ADMINORGTYPESTD ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGETYPE' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_PROJCHANGETYPE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGETYPE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_PROJCHANGETYPE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGETYPE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_PROJCHANGETYPE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGESCENE' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_PROJCHANGESCENE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGESCENE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_PROJCHANGESCENE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGESCENE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_PROJCHANGESCENE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGEOPERATE' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_PROJCHANGEOPERATE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGEOPERATE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_PROJCHANGEOPERATE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGEOPERATE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_PROJCHANGEOPERATE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGETYPE' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_ORGCHANGETYPE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGETYPE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_ORGCHANGETYPE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGETYPE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_ORGCHANGETYPE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_OTCLASSIFY' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_OTCLASSIFY ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_OTCLASSIFY' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_OTCLASSIFY ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_OTCLASSIFY' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_OTCLASSIFY ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FORINUMBER')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FORINUMBER'))
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGEOPERAT' AND KSQL_COL_NAME IN ('FORINUMBER')) 
 ALTER TABLE T_HAOS_CHANGEOPERAT ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGEOPERAT' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_CHANGEOPERAT ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGEOPERAT' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_CHANGEOPERAT ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENESUB' AND KSQL_COL_NAME IN ('FORINUMBER')) 
 ALTER TABLE T_HAOS_CHANGESCENESUB ADD (FORINUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENESUB' AND KSQL_COL_NAME IN ('FORINAME')) 
 ALTER TABLE T_HAOS_CHANGESCENESUB ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENESUB' AND KSQL_COL_NAME IN ('FORISTATUS')) 
 ALTER TABLE T_HAOS_CHANGESCENESUB ADD (FORISTATUS VARCHAR(2) DEFAULT '0' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_ADMINORGTYPE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPESTD_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_ADMINORGTYPESTD_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_ADMINORGLAYER_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGETYPE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_PROJCHANGETYPE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGESCENE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_PROJCHANGESCENE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_PROJCHANGEOPERATE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_PROJCHANGEOPERATE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_OTCLASSIFY_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_OTCLASSIFY_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGETYPE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_ORGCHANGETYPE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_ORGCHANGEREASON_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_CHANGESCENE_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGEOPERAT_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_CHANGEOPERAT_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENESUB_L' AND KSQL_COL_NAME IN ('FORINAME'))
 ALTER TABLE T_HAOS_CHANGESCENESUB_L ADD (FORINAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
/**End D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
