DatabaseProcApplicationCreatedLinks
sybsystemprocssp_dcachestats_obj_details  31 Aug 14Defects Dependencies

1     
2     
3     create procedure sp_dcachestats_obj_details
4         @objid int,
5         @indid int
6     as
7         declare @tmp_obj_size_KB int
8         declare @owner_name varchar(30)
9         declare @index_name varchar(255)
10    
11        select @tmp_obj_size_KB = 0
12        select @index_name = ""
13        select @owner_name = ""
14    
15        /* See note tagged by NOTE_ABOUT_BUILT_INS in file 
16        ** sproc/dbcc_run_configreport
17        */
18        if (@indid = 0)
19        begin
20            select @tmp_obj_size_KB = isnull(reserved_pages(db_id(), id,
21                        case
22                            when indid = 1
23                            then 0
24                            else indid
25                        end), 0)
26                * (@@maxpagesize / 1024)
27            from sysindexes
28            where id = @objid
29                and (indid = 0 or indid = 1)
30        end
31        else
32        begin
33            select @tmp_obj_size_KB = isnull(reserved_pages(db_id(), id, indid), 0)
34                * (@@maxpagesize / 1024),
35                @index_name = name
36            from sysindexes
37            where
38                id = @objid
39                and indid = @indid
40        end
41    
42        select @owner_name = user_name(uid)
43        from sysobjects
44        where id = @objid
45    
46        insert into #obj_details(dbid, owner, objid, indid, index_name, size_KB)
47        values (db_id(), @owner_name, @objid,
48            @indid, @index_name,
49            @tmp_obj_size_KB)
50        return 0
51    
52    


exec sp_procxmode 'sp_dcachestats_obj_details', 'AnyMode'
go

Grant Execute on sp_dcachestats_obj_details to public
go
DEFECTS
 MEST 4 Empty String will be replaced by Single Space 12
 MEST 4 Empty String will be replaced by Single Space 13
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 22
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 29
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 39
 QTYP 4 Comparison type mismatch smallint = int 39
 MGTP 3 Grant to public sybsystemprocs..sp_dcachestats_obj_details  
 MGTP 3 Grant to public sybsystemprocs..sysindexes  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MNER 3 No Error Check should check @@error after insert 46
 MUCO 3 Useless Code Useless Brackets 18
 MTR1 2 Metrics: Comments Ratio Comments: 6% 3
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 4dec - 1exi + 2 3
 MTR3 2 Metrics: Query Complexity Complexity: 25 3

DEPENDENCIES
PROCS AND TABLES USED
writes table tempdb..#obj_details (1) 
reads table sybsystemprocs..sysindexes  
reads table sybsystemprocs..sysobjects