DatabaseProcApplicationCreatedLinks
sybsystemprocssp_dcachestats_obj_details  14 déc. 14Defects Propagation Dependencies

1     
2     
3     create or replace 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
 MAW1 3 Warning message on %name% sybsystemprocs..sysindexes.id: Warning message on sysindexes 20
 MAW1 3 Warning message on %name% sybsystemprocs..sysindexes.id: Warning message on sysindexes 28
 MAW1 3 Warning message on %name% sybsystemprocs..sysindexes.id: Warning message on sysindexes 33
 MAW1 3 Warning message on %name% sybsystemprocs..sysindexes.id: Warning message on sysindexes 38
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 44
 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: 5% 3
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 6 = 5dec - 1exi + 2 3
 MTR3 2 Metrics: Query Complexity Complexity: 25 3

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