/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FENABLE')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FENABLE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FSTATUS')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FSTATUS NVARCHAR(15) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FCREATORID')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FCREATETIME')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FMODIFIERID')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FMODIFYTIME')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FMODIFYTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FDISABLERID')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FDISABLERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_ORG_TYPERELATION' AND KSQL_COL_NAME IN ('FDISABLEDATE')) 
 ALTER TABLE T_ORG_TYPERELATION ADD (FDISABLEDATE DATETIME );

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