/**Begin D:\PDM_UPGRADE\pdm_new\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FDIMID')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FDIMID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FINCLUDESUB')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FINCLUDESUB CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FDIMTYPE')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FDIMTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FSTARTTIME')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FSTARTTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FENDTIME')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FENDTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FCREATORID')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FCREATETIME')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FMODIFIERID')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPROLE' AND KSQL_COL_NAME IN ('FMODIFYTIME')) 
 ALTER TABLE T_PERM_USRGRPROLE ADD (FMODIFYTIME DATETIME );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_PERM_USRGRPROLE', 'FCREATEDATEFIELD', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_PERM_USRGRPROLE', 'FCREATERFIELD', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FOPER'))
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FOPER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FRULECONFTYPE'))
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FRULECONFTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FCREATORID'))
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FCREATETIME')) 
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FMODIFIERID')) 
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USRGRPREL_RULEENT' AND KSQL_COL_NAME IN ('FMODIFYTIME')) 
 ALTER TABLE T_PERM_USRGRPREL_RULEENT ADD (FMODIFYTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USERGROUPSTAFF' AND KSQL_COL_NAME IN ('FFROM_TYPE')) 
 ALTER TABLE T_SEC_USERGROUPSTAFF ADD (FFROM_TYPE VARCHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SEC_USERGROUP' AND KSQL_COL_NAME IN ('FSETED_USRSYCRULE')) 
 ALTER TABLE T_SEC_USERGROUP ADD (FSETED_USRSYCRULE CHAR(1) DEFAULT '0' NOT NULL );

/**End D:\PDM_UPGRADE\pdm_new\BOS_table.sql **/
