DatabaseProcApplicationCreatedLinks
sybsystemprocssp_monitor_report_usage  31 Aug 14Defects Dependencies

1     
2     /*
3     ** sp_monitor_report_usage
4     **
5     **	Produce basic help usage for the 'report' command.
6     {
7     */
8     create procedure sp_monitor_report_usage(
9         @output_type varchar(8)
10    ) as
11        begin
12            declare @usage varchar(10)
13                , @msg varchar(256)
14                , @supported varchar(80)
15                , @prefix varchar(8)
16                , @mondeadlock varchar(11)
17                , @newline char(1)
18                , @tabchar char(1)
19    
20            select @mondeadlock = 'monDeadLock'
21                , @prefix = 'daily_'
22                , @newline = char(10)
23                , @tabchar = char(9)
24    
25            print " "
26            exec sp_getmessage 18954, @usage output
27    
28            -- Build the usage message string, plucking out fragments.
29            --
30            select @msg = @usage
31                + " sp_monitor 'report [using prefix=<string>]' "
32                + ", '<monitoring_type>' "
33                + @newline + @tabchar + @tabchar
34                + "[ <"
35    
36            exec sp_getmessage 19482, @supported output
37            select @msg = @msg + @supported + "> ]"
38            print @msg
39    
40            select @supported = "'deadlock'"
41            exec sp_getmessage 19481, @msg output
42            print @msg, @supported
43    
44            if (@output_type = 'terse')
45                return 0
46    
47            print " "
48            exec sp_getmessage 19483, @msg output
49            print @msg, @mondeadlock
50            print "	sp_monitor report, deadlock"
51    
52            print " "
53            select @supported = "tempdb" -- Reuse @variable for @dbname
54            exec sp_getmessage 19484, @msg output
55            print @msg, @prefix, @mondeadlock, @supported
56            print "	%1!..sp_monitor 'report using prefix=%2!', deadlock"
57                , @supported, @prefix
58    
59            print " "
60            select @prefix = 'weekly_'
61                , @supported = "mondb" -- Reuse @variable for @dbname
62            exec sp_getmessage 19485, @msg output
63            print @msg, @prefix, @mondeadlock, @supported
64            print "	%1!..sp_monitor 'report using prefix=%2!', deadlock, 'May 25, 2006'"
65                , @supported, @prefix
66        end -- }
67    


exec sp_procxmode 'sp_monitor_report_usage', 'AnyMode'
go

Grant Execute on sp_monitor_report_usage to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_monitor_report_usage  
 MNER 3 No Error Check should check return value of exec 26
 MNER 3 No Error Check should check return value of exec 36
 MNER 3 No Error Check should check return value of exec 41
 MNER 3 No Error Check should check return value of exec 48
 MNER 3 No Error Check should check return value of exec 54
 MNER 3 No Error Check should check return value of exec 62
 MUCO 3 Useless Code Useless Brackets in create proc 8
 MUCO 3 Useless Code Useless Begin-End Pair 11
 MUCO 3 Useless Code Useless Brackets 44
 MTR1 2 Metrics: Comments Ratio Comments: 11% 8
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 1dec - 1exi + 2 8
 MTR3 2 Metrics: Query Complexity Complexity: 29 8

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   reads table master..sysmessages (1)  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)