Database | Proc | Application | Created | Links |
sybsystemprocs | sp_helpthreshold | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */ 3 4 /* 5 ** Messages for "sp_helpthreshold" 17910 6 ** 7 ** 17910, "Database '%1!' has no thresholds -- table '%2!' does not exist." 8 ** 17911, "Segment '%1!' does not exist." 9 */ 10 11 create procedure sp_helpthreshold 12 @segname varchar(255) = NULL 13 as 14 15 declare @dbname varchar(255) 16 17 select @dbname = db_name() 18 19 if @@trancount = 0 20 begin 21 set chained off 22 end 23 24 set transaction isolation level 1 25 26 /* 27 ** Make sure our database is recent enough to contain Systhresholds 28 */ 29 if (select name from sysobjects 30 where name = 'systhresholds' 31 and type = 'S') 32 is NULL 33 begin 34 /* 35 ** 17910, "Database '%1!' has no thresholds -- table '%2!' does not 36 ** exist." 37 */ 38 raiserror 17910, @dbname, "systhresholds" 39 return (1) 40 end 41 42 /* 43 ** If user wants a specific segment's thresholds, show those. 44 */ 45 if (@segname is not NULL) 46 begin 47 if (select segment from syssegments where name = @segname) is NULL 48 begin 49 /* 50 ** 17911, "Segment '%1!' does not exist." 51 */ 52 raiserror 17911, @segname 53 return (2) 54 end 55 56 /* 57 ** Get the threshold information for all the user-defined ones. 58 */ 59 select segment_name = s.name, 60 free_pages = t.free_space, 61 last_chance = t.status, 62 threshold_procedure = t.proc_name 63 into #sphelpthreshold1rs 64 from syssegments s, systhresholds t 65 where s.segment = t.segment 66 and s.name = @segname 67 and t.status != 1 68 69 UNION 70 71 /* 72 ** Get the threshold information for the last chance threshold 73 */ 74 select segment_name = s.name, 75 free_pages = lct_admin("reserve", 0), 76 last_chance = t.status, 77 threshold_procedure = t.proc_name 78 from syssegments s, systhresholds t 79 where s.segment = t.segment 80 and s.name = @segname 81 and t.status = 1 82 exec sp_autoformat @fulltabname = #sphelpthreshold1rs, 83 @selectlist = "'segment name' = segment_name,'free pages' = free_pages, 'last chance?' = last_chance, 'threshold procedure' = threshold_procedure" 84 drop table #sphelpthreshold1rs 85 return (0) 86 end 87 88 /* 89 ** Show all thresholds for all segments. 90 */ 91 select segment_name = s.name, 92 free_pages = t.free_space, 93 last_chance = t.status, 94 threshold_procedure = t.proc_name 95 into #sphelpthreshold2rs 96 from syssegments s, systhresholds t 97 where s.segment = t.segment 98 and t.status != 1 99 100 UNION 101 102 select segment_name = s.name, 103 free_pages = lct_admin("reserve", 0), 104 last_chance = t.status, 105 threshold_procedure = t.proc_name 106 from syssegments s, systhresholds t 107 where s.segment = t.segment 108 and t.status = 1 109 exec sp_autoformat @fulltabname = #sphelpthreshold2rs, 110 @selectlist = "'segment name' = segment_name,'free pages' = free_pages, 'last chance?' = last_chance, 'threshold procedure' = threshold_procedure" 111 drop table #sphelpthreshold2rs 112 return (0) 113
exec sp_procxmode 'sp_helpthreshold', 'AnyMode' go Grant Execute on sp_helpthreshold to public go
DEPENDENCIES |
PROCS AND TABLES USED calls proc sybsystemprocs..sp_autoformat reads table tempdb..syscolumns (1) read_writes table tempdb..#colinfo_af (1) calls proc sybsystemprocs..sp_autoformat reads table master..syscolumns (1) reads table tempdb..systypes (1) reads table master..systypes (1) calls proc sybsystemprocs..sp_namecrack reads table sybsystemprocs..sysobjects reads table sybsystemprocs..systhresholds reads table sybsystemprocs..syssegments writes table tempdb..#sphelpthreshold2rs (1) writes table tempdb..#sphelpthreshold1rs (1) |