DatabaseProcApplicationCreatedLinks
sybsystemprocssp_monitor_trace  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     ** sp_monitor_trace
4     **
5     **	Utility procedure to update the trace level in the control table
6     **	in tempdb.
7     **
8     ** Usage:	sp_monitor trace, '1'
9     ** 		sp_monitor trace, '2'
10    {
11    */
12    create or replace procedure sp_monitor_trace(
13        @trace_str varchar(10) = 'a'
14    ) as
15        begin
16            declare @trace int
17                , @nrows int
18    
19            if (@trace_str IS NULL)
20                return 0
21    
22            -- If a valid integer was passed, update the trace level.
23            if (patindex("%[^0-9]%", @trace_str) = 0)
24            begin
25                select @trace = convert(int, @trace_str)
26    
27                update tempdb.dbo.mon_config
28                set configval = @trace
29                where monitor = 'tracing'
30    
31                select @nrows = @@rowcount
32                if (@nrows > 0)
33                begin
34                    print "Updated trace level to %1!. (%2! row(s) affected.)"
35                        , @trace, @nrows
36                end
37            end
38            else
39            begin
40                raiserror 19060, 'sp_monitor_trace', @trace_str
41                return 1
42            end
43    
44            return 0
45        end -- }
46    

DEFECTS
 PERR 6 Parsing Error Could not find definition for table tempdb..mon_config 27
 MULT 4 Using literal database 'tempdb' tempdb..mon_config 27
 QTYP 4 Comparison type mismatch Comparison type mismatch: other vs varchar(7) 29
 MNER 3 No Error Check should check @@error after update 27
 MUCO 3 Useless Code Useless Brackets in create proc 12
 MUCO 3 Useless Code Useless Begin-End Pair 15
 MUCO 3 Useless Code Useless Brackets 19
 MUCO 3 Useless Code Useless Brackets 23
 MUCO 3 Useless Code Useless Brackets 32
 MZMB 3 Zombie: use of non-existent object tempdb..mon_config 27
 MTR1 2 Metrics: Comments Ratio Comments: 22% 12
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 4dec - 2exi + 2 12
 MTR3 2 Metrics: Query Complexity Complexity: 18 12

DEPENDENCIES