1、触电事故应急救援预案16384) and (p.uid = u.uid) or (p.uid = m.groupuid and u.uid = m.memberuid) and p.protecttype 206 /* only grant rows */ and p.action in (26,193,195,196,197) and o.uid u.uid /* no rows for owner */ and not exists ( /* exclude revoked privileges */ select * from sysprotects p1 where p1.protec
2、ttype = 206 and p1.action = p.action and p1.id = p.id and p1.uid = u.uid) union select /* Add rows for table owner */ convert(sysname,db_name() TABLE_QUALIFIER, convert(sysname,user_name(o.uid) TABLE_OWNER, convert(sysname,object_name(o.id) TABLE_NAME, convert(sysname,user_name(u.uid) GRANTOR, conve
3、rt(sysname,user_name(o.uid) GRANTEE, convert(varchar(32),case v.number when 193 then SELECT when 195 then INSERT when 196 then DELETE when 197 then UPDATE else REFERENCES end) PRIVILEGE, convert(varchar(3),YES) IS_GRANTABLE from sysobjects o, master.dbo.spt_values v, sysusers u where object_name(o.i
4、d) like table_name and o.type in (U,V,S) and user_name(o.uid) like table_owner and u.uid = 1 /* grantor is dbo of database */ and v.type = NP /* cross product to get all exposed privileges */ and v.number in (26,193,195,196,197) and not exists ( /* exclude revoked privileges */ select * from sysprot
5、ects p1 where p1.protecttype = 206 and p1.action = v.number and p1.id = o.id and p1.uid = o.uid) order by 2,3,6,5gogrant execute on sp_table_privileges to publicgodump tran master with no_loggoprint creating sp_tablesgo/* Procedure for 6.50 and earlier servers */create procedure sp_tables( table_nam
6、e varchar(96) = null, table_owner varchar(96) = null, table_qualifier varchar(32) = null, table_type varchar(100) = null)as declare type1 varchar(3) declare tableindex int /* Special feature #1: enumerate databases when owner and name are blank but qualifier is explicitly %. */ if table_qualifier =
7、% and table_owner = and table_name = begin /* If enumerating databases */ select TABLE_QUALIFIER = convert(varchar(32),d.name), TABLE_OWNER = convert(varchar(32),null), TABLE_NAME = convert(varchar(32),null), TABLE_TYPE = convert(varchar(32),null), REMARKS = convert(varchar(254),null) /* Remarks are
8、 NULL */ from master.dbo.sysdatabases d where d.name model /* eliminate MODEL database */ order by 1 end /* Special feature #2: enumerate owners when qualifier and name are blank but owner is explicitly %. */ else if table_qualifier = and table_owner = % and table_name = begin /* If enumerating owne
9、rs */ select distinct TABLE_QUALIFIER = convert(varchar(32),null), TABLE_OWNER = convert(varchar(32),user_name(uid), TABLE_NAME = convert(varchar(32),null), TABLE_TYPE = convert(varchar(32),null), REMARKS = convert(varchar(254),null) /* Remarks are NULL */ from sysobjects order by 2 end /* Special f
10、eature #3: enumerate table types when qualifier, owner and name are blank but table type is explicitly %. */ else if table_qualifier = and table_owner = and table_name = and table_type = % begin /* If enumerating table types */ select TABLE_QUALIFIER = convert(varchar(32),null), TABLE_OWNER = conver
11、t(varchar(32),null), TABLE_NAME = convert(varchar(32),null), TABLE_TYPE = convert(varchar(32),rtrim(substring(SYSTEM TABLETABLE VIEW,(colid-1)*12+1,12), REMARKS = convert(varchar(254),null) /* Remarks are NULL */ from sysobjects o, syscolumns c where o.id=c.id and o.name=sysusers and colid=3 end els
12、e begin /* end of special features - do normal processing */ if table_qualifier is not null begin if db_name() table_qualifier begin if table_qualifier = begin /* If empty qualifier supplied */ /* Force an empty result set */ select table_name = select table_owner = end else begin /* If qualifier do
13、esnt match current database */ raiserror 20001 Rush_5 return end end end if table_type is null begin /* Select all ODBC supported table types */ select type1 = SUV end else begin /* TableType is case sensitive if CS server */ select type1 = null if (charindex(SYSTEM TABLE,table_type) 0) select type1
14、 = type1 + S /* Add System Tables */ if (charindex(TABLE,table_type) 0) select type1 = type1 + U /* Add User Tables */ if (charindex(VIEW,table_type) 0) select type1 = type1 + V /* Add Views */ end if table_name is null begin /* If table name not supplied, match all */ select table_name = % end else begin if (table_owner is null) and (charindex(%, table_name) = 0) begin /* If owner not specified and table is specified */ if exists (select * from sysobjects where uid = user_id() and name = table_name and (type = U or type = V or type = S) begin /* Override supplied owner w/owner of ta
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1