1
2 /*
3 ** sp_monitor_report
4 **
5 ** Shell procedure to drive control to sub-procedure for given monitoring
6 ** type, and invoke its 'report' facility.
7 **
8 ** Parameters:
9 ** @montype - Monitoring type.
10 ** @reportcmd - 'report' command, with optional prefix string.
11 ** @filter - Filter arg, that may be used by sub-proc.
12 ** @output - Monitoring-type-specific output modes.
13 **
14 ** Returns:
15 ** Return value from sub-proc.
16 {
17 */
18 create procedure sp_monitor_report(
19 @montype varchar(30)
20 , @reportcmd varchar(30)
21 , @filter varchar(30)
22 , @output varchar(30)
23 ) as
24 begin
25 declare @retval int
26 , @report_procname varchar(30)
27 , @supported varchar(30)
28
29 -- Archiving logic is fairly generic based on the monitoring type,
30 -- but reporting is really monitoring type specific. Hence, call back
31 -- into the monitoring-type-specific driver procedure that will now
32 -- know how to handle the report argument.
33 --
34 if (@montype IN ('deadlock'))
35 begin
36 select @report_procname = "sp_monitor_" + @montype
37 exec @retval = @report_procname @reportcmd, @filter, @output
38 end
39 else
40 begin
41 select @supported = "'deadlock'"
42 raiserror 19481, @supported
43 select @retval = 1
44 end
45 return @retval
46 end -- }
47
exec sp_procxmode 'sp_monitor_report', 'AnyMode'
go
Grant Execute on sp_monitor_report to public
go