/**Begin D:\PDM_UPGRADE\PDM1\HAOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORG' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ADMINORG ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGTYPE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGTYPE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFELEVEL' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_SAFELEVEL ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFELEVEL' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_SAFELEVEL ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFELEVEL' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_SAFELEVEL ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFELEVEL' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_SAFELEVEL ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFETYPE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_SAFETYPE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFETYPE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_SAFETYPE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFETYPE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_SAFETYPE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_SAFETYPE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_SAFETYPE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_COMPANYTYPE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_COMPANYTYPE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_COMPANYTYPE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_COMPANYTYPE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_COMPANYTYPE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_COMPANYTYPE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_COMPANYTYPE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_COMPANYTYPE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_DEPARTMENTTYPE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_DEPARTMENTTYPE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_DEPARTMENTTYPE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_DEPARTMENTTYPE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_DEPARTMENTTYPE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_DEPARTMENTTYPE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_DEPARTMENTTYPE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_DEPARTMENTTYPE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGFUNCTION' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ADMINORGFUNCTION ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGFUNCTION' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_ADMINORGFUNCTION ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGFUNCTION' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGFUNCTION ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGFUNCTION' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGFUNCTION ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ADMINORGLAYER' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_ADMINORGLAYER ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGTEAM' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ORGTEAM ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_ORGCHANGEREASON' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_ORGCHANGEREASON ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_TEAMCOOPRELTYPE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_TEAMCOOPRELTYPE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FORGID')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FCTRLSTRATEGY')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HAOS_CHANGESCENE' AND KSQL_COL_NAME IN ('FCREATEORGID')) 
 ALTER TABLE T_HAOS_CHANGESCENE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );

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