Database | Proc | Application | Created | Links |
sybsystemprocs | sp_helpgroup | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */ 3 /* 4.8 1.1 06/14/90 sproc/src/help */ 4 /* 5 ** Messages for "sp_helpgroup" 17630 6 ** 7 ** 17333, "No group with the specified name exists." 8 */ 9 create procedure sp_helpgroup 10 @grpname varchar(30) = NULL /* group name of interest */ 11 as 12 13 declare @msg varchar(1024) 14 declare @len1 int, @len2 int 15 16 17 if @@trancount = 0 18 begin 19 set chained off 20 end 21 22 set transaction isolation level 1 23 24 /* 25 ** If no group name given, list all the groups. 26 */ 27 if @grpname is NULL 28 begin 29 select Group_name = name, Group_id = gid 30 into #helpgrouprs 31 from sysusers G 32 where ((G.uid between @@mingroupid and @@maxgroupid) or G.uid = 0) 33 and not exists (select * from sysroles R where G.uid = R.lrid) 34 exec sp_autoformat @fulltabname = #helpgrouprs, 35 @orderby = "order by Group_name" 36 drop table #helpgrouprs 37 38 return (0) 39 end 40 41 /* 42 ** Check to see if group exists. 43 */ 44 if not exists (select * from sysusers where name = @grpname 45 and ((uid between @@mingroupid and @@maxgroupid) or uid = 0)) 46 or exists (select name from master.dbo.syssrvroles 47 where name = @grpname) 48 begin 49 /* 17333, "No group with the specified name exists." */ 50 exec sp_getmessage 17333, @msg output 51 print @msg 52 return (1) 53 end 54 55 if (@grpname != "public") 56 begin 57 /* 58 ** List the particulars for the group. 59 */ 60 select Group_name = g.name, Group_id = g.gid, 61 Users_in_group = u.name, Userid = u.uid 62 into #helpgroup1rs 63 from sysusers u, sysusers g where g.name like @grpname 64 and g.uid = u.gid and 65 ((g.uid between @@mingroupid and @@maxgroupid) or g.uid = 0) 66 and u.uid != u.gid 67 exec sp_autoformat @fulltabname = #helpgroup1rs, 68 @orderby = "order by Group_name,Users_in_group" 69 drop table #helpgroup1rs 70 end 71 else 72 begin 73 /* 74 ** Special case for "public" group. List all users, including users 75 ** in other groups. They also belong to "public" group. 76 */ 77 select Group_name = g.name, Group_id = g.gid, 78 Users_in_group = u.name, Userid = u.uid 79 into #helpgroup2rs 80 from sysusers u, sysusers g 81 where g.name like @grpname and 82 ((g.uid between @@mingroupid and @@maxgroupid) or g.uid = 0) 83 and u.uid != u.gid 84 exec sp_autoformat @fulltabname = #helpgroup2rs, 85 @orderby = "order by Group_name,Users_in_group" 86 drop table #helpgroup2rs 87 end 88 return (0) 89
exec sp_procxmode 'sp_helpgroup', 'AnyMode' go Grant Execute on sp_helpgroup to public go
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..sp_getmessage reads table master..sysmessages (1) calls proc sybsystemprocs..sp_validlang reads table master..syslanguages (1) reads table master..syslanguages (1) reads table sybsystemprocs..sysusermessages reads table sybsystemprocs..sysusers writes table tempdb..#helpgroup1rs (1) writes table tempdb..#helpgrouprs (1) writes table tempdb..#helpgroup2rs (1) calls proc sybsystemprocs..sp_autoformat calls proc sybsystemprocs..sp_autoformat reads table master..syscolumns (1) reads table tempdb..syscolumns (1) calls proc sybsystemprocs..sp_namecrack reads table master..systypes (1) read_writes table tempdb..#colinfo_af (1) reads table tempdb..systypes (1) reads table sybsystemprocs..sysroles reads table master..syssrvroles (1) CALLERS called by proc sybsystemprocs..sp_helpuser |