1;M;Tables within Database;Select distinct b.name,b.uid from dbo.sysobjects a, dbo.sysusers b where a.type = 'U' and a.uid=b.uid order by 1;Owner;1500;Id;1;
3;M;Views within Database;Select distinct b.name,b.uid from dbo.sysobjects a, dbo.sysusers b where a.type='V' and a.uid=b.uid order by 1;Owner;1500;Id;1;
4;M;System Tables within Database;Select distinct b.name,b.uid from dbo.sysobjects a, dbo.sysusers b where a.type = 'S' and a.uid=b.uid order by 1;Owner;1500;Id;1;
5;M;Triggers within Database;Select distinct b.name, b.uid from dbo.sysobjects a, dbo.sysusers b where a.type='TR' and a.uid=b.uid order by 1;Owner;1500;Id;1;
6;M;Defaults within Database;Select distinct b.name,b.uid from dbo.sysobjects a, dbo.sysusers b where a.type = 'D' and a.uid=b.uid order by 1;;1500;;1;
7;U;Users within Database;Select name, uid from dbo.sysusers order by 1;User;1500;Id;1;
8;M;Rules within Database;Select distinct b.name, b.uid from dbo.sysobjects a, dbo.sysusers b where a.type = 'R' and a.uid=b.uid order by 1;Owner;1500;Id;1;
9;M;Procedures within Database;Select distinct b.name, b.uid from dbo.sysobjects a, dbo.sysusers b where a.type in ('P','X') and a.uid=b.uid order by 1;Owner;1500;Id;1;
10;M;Defaults within Database;Select distinct b.name, b.uid from dbo.sysobjects a, dbo.sysusers b where a.type = 'D' and a.uid=b.uid order by 1;Owner;1500;Id;1;
11;M1;Tables within Owner;Select a.name, id from dbo.sysobjects a where a.type ='U' and a.uid=convert(smallint,?) order by 1;Table;2520;Id;1;
12;M1;Views within Owner;Select a.name, id from dbo.sysobjects a where a.type = 'V' and a.uid=convert(smallint,?) order by 1;Table;2500;Id;1;
14;M1;Triggers within Owner;Select name, id from dbo.sysobjects a where type='TR' and uid=convert(smallint,?) order by 1;Table;2500;Id;1;
15;M1;Logons for user;Select a.name,b.name ,a.dbname,a.suid from master.dbo.syslogins a left outer join dbo.sysusers b on a.suid=b.suid;Login name;1000;User name in this db;1600;Default database ;1455;Id;1;
16;M;Users/Groups within Database;Select name from dbo.sysusers order by 1;User Name;1200;Group?;800;
17;M1;Procedures within Owner;Select name, id from dbo.sysobjects a where type in ('P','X') and uid=convert(smallint,?) order by 1;Procedure;2500;Id;1;
18;M1;Rules within Owner;Select name,id from dbo.sysobjects a where type = 'R' and uid=convert(smallint,?) order by 1;Rule;2500;Id;1;
19;M1;Defaults within Owner;Select name,id from dbo.sysobjects a where type = 'D' and uid=convert(smallint,?) order by 1;Default;2500;Id;1;
20;M1;Parameters for;Select c.name,(select name from dbo.systypes where type=c.type and usertype=c.usertype) , c.length, c.scale,substring('NY',convert(smallint, convert(bit, c.status&8))+1,1), convert(char,c.number) from dbo.syscolumns c where c.id =convert(int,?) order by c.number, c.colid;Name;2000;Type;800;Length;600;Scale;600;Nulls;600;Proc Section;1000;
'21;M1;Access list for;Select user_name(uid), action , substring('YESNO REV',protecttype*3 +1,3), uid from dbo.sysprotects where id=convert(int,?) ;User;1500;Privilege;1000;Grantable?;1000;Id;1;
21;M1;Access list for;Select user_name(uid), action, substring('YESNO REV',protecttype*3 +1,3), uid from dbo.sysprotects where id=convert(int,?) ;User;1500;Privilege;1000;Grantable?;1000;Id;1;
22;C1;Column list for;Select c.name, t2.name, c.length, c.scale, substring('NY',convert(smallint, convert(bit, c.status&8))+1,1), t.name from dbo.syscolumns c, dbo.systypes t, dbo.systypes t2 where c.usertype=t.usertype and c.id =convert(int,?) and t.type=t2.type and t2.usertype=(select min(usertype) from dbo.systypes where type=t2.type and usertype>0) order by c.colid,t2.name;Name;2000;Type;1200;Length;600;Scale;600;Nulls;600;User Type;2500;
23;S1;Full detail of;Select * from dbo.sysobjects where id=convert(int,?);Column;1500;Value;3000;
24;M1;Referenced Tables for;Select u.name, o.name, object_name(r.constrid), col_name(tableid,fokey1)+' '+coalesce(col_name(tableid,fokey2),'')+' '+coalesce(col_name(tableid,fokey3),'')+' '+coalesce(col_name(tableid,fokey4),''), col_name(reftabid,refkey1)+' '+coalesce(col_name(reftabid,refkey2),'')+' '+coalesce(col_name(reftabid,refkey3),'')+' '+coalesce(col_name(reftabid,refkey4),''),o.id from dbo.sysreferences r, dbo.sysobjects o, dbo.sysusers u where r.reftabid=o.id and o.uid=u.uid and r.tableid=convert(int,?) order by 1,2,3;Owner;1200;Referenced Table;1800;Constraint;1000;Cols (FK);1500;PK in Ref Tab;1500;Id;1;
25;M1;Column Default values for ;Select a.name,c.text from dbo.syscolumns a, dbo.syscomments c where a.cdefault=c.id and c.texttype=0 and c.colid=1 and a.id=convert(int,?) order by 1;Column;2000;Default Value;3000;Default Name;1500;Id;1;
26;X1;Text of;Select text from dbo.syscomments where id = convert(int,?) and texttype=0 order by colid;Text;5000;
28;X1;Text of Procedure ;Select text from dbo.syscomments where id = convert(int,?) and texttype=0 order by number,colid;Procedure Text;5460;
29;V1;Text of View;Select text from dbo.syscomments where id =convert(int,?) and texttype=0 order by colid;View Text;2505;
30;W1;Text of View;Select text from dbo.syscomments where id =convert(int,?) and texttype=0 order by colid;View Text;5715;
31;M1;Triggers on Table;Select user_name(b.uid), b.name, (case when b.id=a.deltrig then 'Delete' when b.id=a.updtrig then 'Update' when b.id=a.instrig then 'Insert' end ), b.id from dbo.sysobjects a, dbo.sysobjects b where (b.id = a.deltrig or b.id = a.updtrig or b.id=a.instrig) and a.id=convert(int,?) order by 1,2,3;Owner;1500;Trigger Name;2500;Event;800;Id;1;
32;M1;Tables within Owner;Select a.name,id from dbo.sysobjects a where a.type ='U' and a.uid=convert(smallint,?) order by 1;Table;2000;Id;1000;
33;M1;Views within Owner;Select a.name,id from dbo.sysobjects a where a.type = 'V' and a.uid=convert(smallint,?) order by 1;View;2000;Id;1000;
34;D;Contents of;unused;Name;1500;
35;X;Definition of Constraint;Select text from dbo.syscomments where id = (select id from dbo.sysobjects a, dbo.sysusers b where a.uid=b.uid and b.name=? and a.name=?) and texttype=0 order by colid;Constraint Definition;6360;
36;M1;Triggers within Owner;Select name, id from dbo.sysobjects a where type='TR' and uid=convert(smallint,?) order by 1;Trigger;2000;Id;1000;
37;M1;System Tables within Owner;Select name,id from dbo.sysobjects c where type = 'S' and uid =convert(smallint,?) order by 1;Table;2500;Id;1;
38;M;Triggers within Owner;Select name, id,id from dbo.sysobjects a where type='TR' and uid=convert(smallint,?) order by 1;Table;1500;Desc;2000;
39;S2;Full details of;Select * from dbo.sysindexes where id=convert(int,?) and indid=convert(int,?);Column;1500;Value;3000;
40;M1;System Tables within Owner;Select name, id from dbo.sysobjects where type = 'S' and uid =convert(smallint,?) order by 1;Table;2000;Id;1000;
41;M1;Objects referencing;Select user_name(o.uid), o.name, o.type, convert(char,depnumber), o.id from dbo.sysdepends d, dbo.sysobjects o where d.id=o.id and d.depid =convert(int,?) order by 1,2;Owner;1500;Name;2000;Type;600;Proc Number;1200;Id;1;
42;M1;Dependent Tables for;Select u.name, o.name, object_name(r.constrid), col_name(reftabid,refkey1)+' '+coalesce(col_name(reftabid,refkey2),'')+' '+coalesce(col_name(reftabid,refkey3),'')+' '+coalesce(col_name(reftabid,refkey4),''),col_name(tableid,fokey1)+' '+coalesce(col_name(tableid,fokey2),'')+' '+coalesce(col_name(tableid,fokey3),'')+' '+coalesce(col_name(tableid,fokey4),''),o.id from dbo.sysreferences r, dbo.sysobjects o, dbo.sysusers u where r.tableid=o.id and o.uid=u.uid and r.reftabid=convert(int,?) order by 1,2,3;Owner;1200;Dependent Table;1800;Constraint;1000;Cols (PK);1500;FK in Dep Tab;1500;Id;1;
43;M1;Sections in Procedure;Select distinct number, id , number from dbo.syscomments where id = convert(int,?) order by number;Procedure Section;1500;Id;1;Number;1;
44;M1;Rules within Owner;Select name, id from dbo.sysobjects a where type = 'R' and uid=convert(smallint,?) order by 1;Rule;2000;Id;1000;
45;M1;Procedures within Owner;Select name, id from dbo.sysobjects a where type in ('P','X') and uid=convert(smallint,?) order by 1;Procedure;2000;Id;1000;
46;S1;Full detail of;Select * from master.dbo.syslogins where suid=convert(smallint,?);Column;1500;Value;3000;
47;M1;Login user;Select b.name, a.dbname, b.uid from master.dbo.syslogins a, dbo.sysusers b where a.suid*=b.suid and a.suid=convert(smallint,?);User name;1500;Default Database;1500;id;1;
48;X2;Text of Section;Select text from dbo.syscomments where id = convert(int,?) and number=convert(int,?) and texttype=0 order by colid;Section Text;6135;
49;B1;Table authorities for;Select user_name(o.uid),o.name, action , substring('YESNO REV',protecttype*3 +1,3), user_name(p.grantor), p.id from dbo.sysprotects p, dbo.sysobjects o where p.uid=convert(smallint,?) and p.id=o.id and o.type <> 'P' order by 1,2,3;Owner;1500;Name;2000;Privilege;1000;Grantable?;900;Granted by;900;Id;1;
50;M1;Objects referenced by;Select distinct user_name(o.uid), o.name, o.type, o.id from dbo.sysdepends d, dbo.sysobjects o where d.depid=o.id and d.id =convert(int,?) order by 1,2;Owner;1500;Name;2000;Type;600;Id ;1;
51;M1;Objects referencing;Select distinct user_name(o.uid), o.name, o.type, o.id from dbo.sysdepends d, dbo.sysobjects o where d.id=o.id and d.depid =convert(int,?) order by 1,2;Owner;1500;Name;2000;Type;600;Id;1;
52;M1;Check Constraints on;Select col_name(c.tableid,c.colid), d.text, object_name(c.constrid) from dbo.sysconstraints c, dbo.syscomments d where d.id=c.tableid and d.texttype=0 and d.colid=1 and c.tableid=convert(int,?) order by 1;Column;1500;Text;2000;Constraint;1500;Domain;800;Length;800;Desc;1500;
53;M1;Indexes on;Select i.name, i.indid, substring(' Y',convert(smallint, convert(bit, i.status&2048))+1,1), substring(' Y',convert(smallint, convert(bit, i.status&16))+1,1), substring(' Y',convert(smallint, convert(bit, i.status&2))+1,1), index_col(user_name(o.uid)+'.'+o.name,indid,1), index_col(user_name(o.uid)+'.'+o.name,indid,2), index_col(user_name(o.uid)+'.'+o.name,indid,3), index_col(user_name(o.uid)+'.'+o.name,indid,4),index_col(user_name(o.uid)+'.'+o.name,indid,5),i.id,indid from dbo.sysindexes i,dbo.sysobjects o WHERE o.id=i.id and o.id =convert(int,?) and indid between 1 and 254 order by 2;Name;1800;Id;400;PK?;400;Clust?;600;Uniq?;600;Column 1;1500;Column 2;1500;Column 3;1500;Column 4;1500;Column 5;1500;Id;1;Indid;1;
54;M1;Users in Group;Select name,uid from dbo.sysusers where gid=convert(int,?) order by 1;User;1500;Id;1;
55;M1;Groups for user;Select b.name, b.uid from dbo.sysusers a, dbo.sysusers b where a.uid=convert(smallint,?) and a.gid=b.uid order by 1;Group;1500;Id;1;
56;A1;Table access grid for;Select distinct user_name(o.uid),o.name, action , substring('YESNO REV',protecttype*3 +1,3), p.id from dbo.sysprotects p, dbo.sysobjects o where p.uid=convert(smallint,?) and p.id=o.id and o.type <> 'P' order by 1,2;Owner;1500;Name;1800;Select;600;Update;700;Insert;600;Delete;600;References;1000;Execute;1000;Id;1;
57;M1;Tables within Owner;Select o.name, rowcnt(doampg), data_pgs(i.id,doampg), o.id from dbo.sysobjects o, dbo.sysindexes i where i.id=o.id and indid<2 and o.type ='U' and o.uid=convert(smallint,?) order by 1;Table;2000;Rows;1000;Pages;800;Id;1;
58;S1;User Details;select name as "User Name", uid as "User Id", gid as "Group Id", suid as "Server User Id", suser_name(suid) as "Server User Name" From dbo.sysusers where uid=convert(smallint,?);Column;2000;Value;2000;
59;M1;Table authorities for;Select user_name(o.uid),o.name, 'EXECUTE', substring('YESNO REV',protecttype*3 +1,3), user_name(p.grantor), p.id from dbo.sysprotects p, dbo.sysobjects o where p.uid=convert(smallint,?) and p.id=o.id and p.action=224 and o.type='P' order by 1,2,3;Owner;1500;Name;1800;Privilege;1000;Grantable?;900;Granted by;900;Id;1;
60;S1;Table sizing info for;select rowcnt(doampg) as "Rows", data_pgs(id,doampg) as "Pages", segment as "Segment", maxrowsperpage as "Max rows/page", minlen as "Min row len", maxlen as "Max row len" From dbo.sysindexes Where indid < 2 and id=convert(int,?);Column;1500;Value;2000;
61;M1;Base Table for;Select user_name(b.uid), b.name, (case when b.id=a.deltrig then 'Delete' when b.id=a.updtrig then 'Update' when b.id=a.instrig then 'Insert' end ), b.id from dbo.sysobjects a, dbo.sysobjects b where (b.id = a.deltrig or b.id = a.updtrig or b.id=a.instrig) and a.id=convert(int,?);Owner;1500;Table Name;2000;Event;800;Id;1;
62;M2;Parameters for section;Select c.name,(select name from dbo.systypes where type=c.type and usertype=c.usertype) , c.length, c.scale, substring('NY',convert(smallint, convert(bit, c.status&8))+1,1) from dbo.syscolumns c where c.id =convert(int,?) and c.number=convert(int,?) order by c.colid;Name;2000;Type;800;Length;600;Scale;600;Nulls;600;
63;E;Column list for;Select c.name, t2.name, c.length, c.scale, substring('NY',convert(smallint, convert(bit, c.status&8))+1,1), t.name,c.id from dbo.syscolumns c, dbo.systypes t, dbo.systypes t2, dbo.sysobjects o where o.id=c.id and c.usertype=t.usertype and o.uid=user_id(?) and o.name =? and t.type=t2.type and t2.usertype=(select min(usertype) from dbo.systypes where type=t2.type and usertype>0) order by c.colid,t2.name;Name;2000;Type;800;Length;600;Scale;600;Nulls;600;User Type;1200;Id;1;
64;M1;Tables within Owner;Select o.name, rowcnt(doampg), data_pgs(i.id,doampg), o.id from dbo.sysobjects o, dbo.sysindexes i where i.id=o.id and indid<2 and o.type ='S' and o.uid=convert(smallint,?) order by 1;Table;2000;Rows;1000;Pages;800;Id;1;
66;M1;Basic column list for;Select c.name,t.name, c.length, c.scale, substring('NY',convert(smallint, convert(bit, c.status&8))+1,1), '' from dbo.syscolumns c, dbo.systypes t where c.usertype=t.usertype and c.id =convert(int,?) order by c.number, c.colid;Name;2000;Type;800;Length;600;Scale;600;Nulls;600;Id;1;
67;M1;Defaults within Owner;Select name, id from dbo.sysobjects a where type = 'D' and uid=convert(smallint,?) order by 1;Default;2000;Id;1000;
68;M1;Columns using Rule;Select user_name(b.uid),b.name,a.name,a.id from dbo.syscolumns a, dbo.sysobjects b WHERE a.domain=convert(int,?) and a.id=b.id order by 1,2,3;Owner;1500;Table Name;2000;Column;1500;Id;1;
69;M1;Columns using Default;Select user_name(b.uid),b.name,a.name,a.id from dbo.syscolumns a, dbo.sysobjects b WHERE a.cdefault=convert(int,?) and a.id=b.id order by 1,2,3 ;Owner;1500;Table Name;1800;Column;1500;Id;1;
70;M1;Login for user;select a.name, dbname From master.dbo.syslogins a, dbo.sysusers b Where a.suid = b.suid and b.uid=convert(smallint,?);Login Name;1500;Default Database;2000;
71;Q1;View as Query;Select text from dbo.syscomments where id =convert(int,?) and texttype=0 order by colid;View Text;5715;
72;P1;Parameters for;SELECT c.name,'in',(select name from dbo.systypes where c.type=c.type and usertype=c.usertype), c.length, c.scale, 'Y', convert(char,c.number) FROM dbo.sysobjects sys, dbo.syscolumns c WHERE sys.id=c.id AND sys.uid = user_id(?) AND sys.name = ? ORDER BY c.number, c.colid;Name;2000;ptype;800;Type;800;Length;600;Scale;600;Nulls;600;Proc Section;1000;