DatabaseProcApplicationCreatedLinks
sybsystemprocssp_add_resource_limit  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     
4     /*
5     ** Messages for "sp_add_resource_limit"
6     **
7     ** 17231, "No login with the specified name exists."
8     ** 17240, "'%1!' is not a valid name."
9     ** 17260, "Can't run %1! from within a transaction."
10    ** 17261, "Only the System Administrator (SA) may execute this procedure."
11    ** 18182, "Timerange name must be non-NULL."
12    ** 18199, "Unknown time range name '%1!'."
13    ** 18202, "At least one of the login or application name must be non-NULL."
14    ** 18203, "Limit type must be non-NULL.
15    ** 18204, "Unknown limit type '%1!'."
16    ** 18205, "Limit value must be non-NULL."
17    ** 18206, "Illegal limit value %1!. Value must be non-negative."
18    ** 18207, "Illegal action %1!."
19    ** 18208, "Illegal enforcement-time value %1! for this limit type."
20    ** 18209, "Illegal scope value %1! for this limit type."
21    ** 18210, "Unknown starting time value '%1!' found in systime ranges."
22    ** 18211, "Unknown ending time value '%1!' found in systimeranges."
23    ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
24    ** 18213, "This user/application can have only one limit for each distinct combination of time range, limit type, enforcement time and scope."
25    ** 18214, "New resource limit created."
26    ** 18773, "HA_LOG: HA consistency check failure in stored procedure '%1!' on companion server '%2!'"
27    ** 18778, "Unable to find login '%1!' with id '%2!' in syslogins.
28    ** 18779, "Unable to find the time range '%1!' with id '%2!' in systimeranges.
29    ** 18781, "Unable to find a limit type with name '%1!' and id '%2!'."
30    */
31    
32    /* 
33    ** IMPORTANT: Please read the following instructions before
34    **   making changes to this stored procedure.
35    **
36    **	To make this stored procedure compatible with High Availability (HA),
37    **	changes to certain system tables must be propagated 
38    **	to the companion server under some conditions.
39    **	The tables include (but are not limited to):
40    **		syslogins, sysservers, sysattributes, systimeranges,
41    **		sysresourcelimits, sysalternates, sysdatabases,
42    **		syslanguages, sysremotelogins, sysloginroles,
43    **		sysalternates (master DB only), systypes (master DB only),
44    **		sysusers (master DB only), sysprotects (master DB only)
45    **	please refer to the HA documentation for detail.
46    **
47    **	Here is what you need to do: 
48    **	For each insert/update/delete statement, add three sections to
49    **	-- start HA transaction prior to the statement
50    **	-- add the statement
51    **	-- add HA synchronization code to propagate the change to the companion
52    **
53    **	For example, if you are adding 
54    **		insert master.dbo.syslogins ......
55    **	the code should look like:
56    **	1. Before that SQL statement:
57    **		
58    **	2. Now, the SQL statement:
59    **		insert master.dbo.syslogins ......
60    **	3. Add a HA synchronization section right after the SQL statement:
61    **		
62    **
63    **	You may need to do similar change for each built-in function you
64    **	want to add.
65    **
66    **	Finally, add a separate part at a place where it can not
67    **	be reached by the normal execution path:
68    **	clean_all:
69    **		
70    **		return (1)
71    */
72    
73    create or replace procedure sp_add_resource_limit
74        @name varchar(255), /* login to which limit applies */
75        @appname varchar(255), /* application to which limit applies */
76        @rangename varchar(255), /* timerange during limit applied */
77        @limittype varchar(30), /* what's being limited */
78        @limitvalue int, /* upper-bound value of limit */
79        @enforced int = NULL, /* before or during execution */
80        @action int = 2, /* what to do if limit is violated */
81        @scope int = NULL /* scope of limit */
82    as
83    
84        declare @limitid smallint
85        declare @rangeid smallint
86        declare @current_range int
87        declare @enforced_arg int
88        declare @action_arg int
89        declare @scope_arg int
90        declare @msg varchar(1024)
91        declare @start_dt datetime
92        declare @end_dt datetime
93        declare @cur_start_dt datetime
94        declare @cur_end_dt datetime
95        declare @startdaynum int
96        declare @enddaynum int
97        declare @cur_startdaynum int
98        declare @cur_enddaynum int
99        declare @tmp_starttime varchar(30)
100       declare @tmp_endtime varchar(30)
101       declare @HA_CERTIFIED tinyint /* Is the SP HA certified ? */
102       declare @retstat int
103       declare @dummy int
104       declare @nullarg varchar(1)
105       declare @gp_enabled int
106   
107   
108   
109       select @HA_CERTIFIED = 0
110   
111       select @nullarg = NULL
112       execute @retstat = sp_aux_checkroleperm "sa_role", "manage resource limit",
113           @nullarg, @gp_enabled output
114   
115   
116       if (@gp_enabled = 0)
117       begin
118           /* validate that this guy is really the sa */
119           if (proc_role("sa_role") = 0) return 1
120       end
121       else
122       begin
123           select @dummy = proc_auditperm("manage resource limit",
124                   @retstat)
125       end
126   
127       if (@retstat != 0)
128       begin
129           return (1)
130       end
131   
132   
133   
134       /* check to see if we are using HA specific SP for a HA enabled server */
135       exec @retstat = sp_ha_check_certified 'sp_add_resource_limit', @HA_CERTIFIED
136       if (@retstat != 0)
137           return (1)
138   
139       if @@trancount > 0
140       begin
141           /*
142           ** 17260, "Can't run %1! from within a transaction." 
143           */
144           raiserror 17260, "sp_add_resource_limit"
145           return (1)
146       end
147   
148       if ((@name is null) and (@appname is null))
149       begin
150           /*
151           ** 18202, "At least one of the login or application name must be non-NULL."
152           */
153           raiserror 18202
154           return (1)
155       end
156   
157       /* Is login valid? */
158       if ((@name is not null) and not exists
159                   (select * from master.dbo.syslogins where name = @name and
160                       ((status & 512) != 512))) /* not LOGIN PROFILE */
161       begin
162           /*
163           ** 17231, "No login with the specified name exists."
164           */
165           raiserror 17231
166           return (1)
167       end
168   
169       /* Has a legal range been specified? */
170   
171       select @rangename = rtrim(@rangename)
172   
173       if (@rangename is null)
174       begin
175           /*
176           ** 18182, "Timerange name must be non-NULL."
177           */
178           raiserror 18182
179           return (1)
180       end
181       else if not exists
182               (select * from master.dbo.systimeranges where name = @rangename)
183       begin
184           /*
185           ** 18199, "Unknown time range name '%1!'."
186           */
187           raiserror 18199, @rangename
188           return (1)
189       end
190   
191       /* Has a legal limit type been specified? */
192       if (@limittype is null)
193       begin
194           /*
195           ** 18203, "Limit type must be non-NULL.
196           */
197           raiserror 18203
198           return (1)
199       end
200       else if not exists
201               (select * from master.dbo.spt_limit_types where name = @limittype)
202       begin
203           /*
204           ** 18204, "Unknown limit type '%1!'."
205           */
206           raiserror 18204, @limittype
207           return (1)
208       end
209   
210       /* Has a limit value been specified? */
211       if (@limitvalue is null)
212       begin
213           /*
214           ** 18205, "Limit value must be non-NULL."
215           */
216           raiserror 18205
217           return (1)
218       end
219       else if (@limitvalue <= 0)
220       begin
221           /*
222           ** 18206, "Illegal limit value %1!. Value must be non-negative."
223           */
224           raiserror 18206, @limitvalue
225           return (1)
226       end
227   
228       /* Has a legal action been specified? */
229       /* If NULL, the default (batch abort) is taken */
230       if (@action is null)
231       begin
232           select @action_arg = 2
233       end
234       else if ((@action < 1) or (@action > 5))
235       begin
236           /*
237           ** 18207, "Illegal action %1!."
238           */
239           raiserror 18207, @action
240           return (1)
241       end
242       else
243       begin
244           select @action_arg = @action
245       end
246   
247       /* Has a legal enforcement time been specified? */
248       if (@enforced is NULL)
249       begin
250           select @enforced_arg = enforced from master.dbo.spt_limit_types where name = @limittype
251       end
252       else if (((@enforced & (select enforced from master.dbo.spt_limit_types where name = @limittype)) != @enforced) or (@enforced = 0))
253       begin
254           /*
255           ** 18208, "Illegal enforcement-time value %1! for this limit type."
256           */
257           raiserror 18208, @enforced
258           return (1)
259       end
260       else
261       begin
262           select @enforced_arg = @enforced
263       end
264   
265       /* Has a legal scope been specified? */
266       if (@scope is NULL)
267       begin
268           select @scope_arg = scope from master.dbo.spt_limit_types where name = @limittype
269       end
270       else if (((@scope & (select scope from master.dbo.spt_limit_types where name = @limittype)) != @scope) or (@scope = 0))
271       begin
272           /*
273           ** 18209, "Illegal scope value %1! for this limit type."
274           */
275           raiserror 18209, @scope
276           return (1)
277       end
278       else
279       begin
280           select @scope_arg = @scope
281       end
282   
283       /* Get the id# corresponding to the limit */
284       select @limitid = id from master.dbo.spt_limit_types where name = @limittype
285   
286       /* Get the id# corresponding to the timerange */
287       select @rangeid = id from master.dbo.systimeranges
288       where name = @rangename
289   
290       /* Get the starting time for the range used by this limit */
291       select @tmp_starttime = starttime from master.dbo.systimeranges
292       where id = @rangeid
293   
294       /* Get the ending time for the range used by this limit */
295       select @tmp_endtime = endtime from master.dbo.systimeranges
296       where id = @rangeid
297   
298       /* Get the starting day for the range used by this limit */
299       select @startdaynum = startday from master.dbo.systimeranges
300       where name = @rangename
301   
302       /* Get the ending day for the range used by this limit */
303       select @enddaynum = endday from master.dbo.systimeranges
304       where name = @rangename
305   
306       /* Convert the starting time to datetime so we can do arithmetic */
307       select @start_dt = convert(datetime, @tmp_starttime)
308       if (@start_dt is null)
309       begin
310           /*
311           ** 18210, "Unknown starting time value '%1!' found in systimeranges."
312           */
313           raiserror 18210, @tmp_starttime
314           return (1)
315       end
316   
317       /* Convert the ending time to datetime so we can do arithmetic */
318       select @end_dt = convert(datetime, @tmp_endtime)
319       if (@end_dt is null)
320       begin
321           /*
322           ** 18211, "Unknown ending time value '%1!' found in systimeranges."
323           */
324           raiserror 18211, @tmp_endtime
325           return (1)
326       end
327   
328       /* Cursor result: ranges associated with limits currently imposed 
329       ** upon the given user/application
330       */
331       declare c1 cursor for
332       select distinct rangeid from master.dbo.sysresourcelimits
333       where ((name = @name) and (appname = @appname)) or
334           ((name = @name) and (@appname is null)) or
335           ((name = @name) and (appname is null)) or
336           ((name is null) and (appname = @appname)) or
337           ((@name is null) and (appname = @appname))
338   
339       open c1
340   
341       fetch c1 into @current_range
342   
343       /* We need to peruse the cursor results to see if this new
344       ** limit overlaps with another limit for this user/application.
345       */
346       while (@@sqlstatus != 2)
347       begin
348   
349           if (@current_range != @rangeid)
350           begin
351   
352               /* Get the start and end days for current range */
353               select @cur_startdaynum = startday from
354                   master.dbo.systimeranges
355               where id = @current_range
356               select @cur_enddaynum = endday from
357                   master.dbo.systimeranges
358               where id = @current_range
359   
360               /* Get the start and end times for current range */
361               select @tmp_starttime = starttime from
362                   master.dbo.systimeranges
363               where id = @current_range
364               select @tmp_endtime = endtime from
365                   master.dbo.systimeranges
366               where id = @current_range
367               select @cur_start_dt = convert(datetime, @tmp_starttime)
368               select @cur_end_dt = convert(datetime, @tmp_endtime)
369   
370               /* See if the limit overlaps with any other
371               ** limit defined for this user/application
372               ** (excepting limits defined for the exact
373               ** same timerange).
374               */
375   
376               /* This is the non-wrapping case, for starttime.
377               ** If (the current range doesn't wrap around the
378               ** end of the week)
379               ** and
380               ** (the days of the new limit's range
381               ** overlap with the current range)
382               ** and 
383               ** (the starttime of the new limit's range is after
384               ** the starttime of the current range)
385               ** and 
386               ** (the endtime of the new limit's range is before
387               ** the endtime of the current range, with 00:00
388               ** being taken as midnight)
389               ** then we have an overlap, so raise an error
390               ** and return.
391               */
392               if
393                   (@cur_startdaynum <= @cur_enddaynum)
394                   and
395                   (((@startdaynum >= @cur_startdaynum) and
396                           (@startdaynum <= @cur_enddaynum)) or
397                       ((@enddaynum >= @cur_startdaynum) and
398                           (@enddaynum <= @cur_enddaynum)) or
399                       ((@startdaynum <= @cur_startdaynum) and
400                           (@enddaynum >= @cur_enddaynum)))
401                   and
402                   (@start_dt >= @cur_start_dt)
403                   and
404                   ((@start_dt < @cur_end_dt) or
405                       ((datepart(hour, @cur_end_dt) = 0) and
406                           (datepart(minute, @cur_end_dt) = 0) and
407                           (datepart(second, @cur_end_dt) = 0)))
408               begin
409                   /*
410                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
411                   */
412                   raiserror 18212, @current_range
413                   return (1)
414               end
415   
416               /* This is the wrapping case, for starttime.
417               */
418               if
419                   (@cur_startdaynum > @cur_enddaynum)
420                   and
421                   ((@startdaynum >= @cur_startdaynum) or
422                       (@startdaynum <= @cur_enddaynum) or
423                       (@enddaynum >= @cur_startdaynum) or
424                       (@enddaynum <= @cur_enddaynum) or
425                       ((@startdaynum > @enddaynum) and
426                           (@startdaynum <= @cur_startdaynum) and
427                           (@enddaynum >= @cur_enddaynum)))
428                   and
429                   (@start_dt >= @cur_start_dt)
430                   and
431                   ((@start_dt < @cur_end_dt) or
432                       ((datepart(hour, @cur_end_dt) = 0) and
433                           (datepart(minute, @cur_end_dt) = 0) and
434                           (datepart(second, @cur_end_dt) = 0)))
435               begin
436                   /*
437                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
438                   */
439                   raiserror 18212, @current_range
440                   return (1)
441               end
442   
443               /* This is the non-wrapping case, for endtime.
444               ** If (the current range doesn't wrap around the
445               ** end of the week)
446               ** and
447               ** (the days of the new limit's range
448               ** overlap with the current range)
449               ** and 
450               ** (the endtime of the new limit's range is before
451               ** the endtime of the current range, with 00:00
452               ** being taken as midnight)
453               ** and 
454               ** (the endtime of the new limit's range is after
455               ** the starttime of the current range)
456               ** then we have an overlap, so raise an error
457               ** and return.
458               */
459               if
460                   (@cur_startdaynum <= @cur_enddaynum)
461                   and
462                   (((@startdaynum >= @cur_startdaynum) and
463                           (@startdaynum <= @cur_enddaynum)) or
464                       ((@enddaynum >= @cur_startdaynum) and
465                           (@enddaynum <= @cur_enddaynum)) or
466                       ((@startdaynum <= @cur_startdaynum) and
467                           (@enddaynum >= @cur_enddaynum)))
468                   and
469                   ((@end_dt <= @cur_end_dt) or
470                       ((datepart(hour, @cur_end_dt) = 0) and
471                           (datepart(minute, @cur_end_dt) = 0) and
472                           (datepart(second, @cur_end_dt) = 0)))
473                   and
474                   (@end_dt > @cur_start_dt)
475               begin
476                   /*
477                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
478                   */
479                   raiserror 18212, @current_range
480                   return (1)
481               end
482   
483               /* This is the wrapping case, for endtime.
484               */
485               if
486                   (@cur_startdaynum > @cur_enddaynum)
487                   and
488                   ((@startdaynum >= @cur_startdaynum) or
489                       (@startdaynum <= @cur_enddaynum) or
490                       (@enddaynum >= @cur_startdaynum) or
491                       (@enddaynum <= @cur_enddaynum) or
492                       ((@startdaynum > @enddaynum) and
493                           (@startdaynum <= @cur_startdaynum) and
494                           (@enddaynum >= @cur_enddaynum)))
495                   and
496                   ((@end_dt <= @cur_end_dt) or
497                       ((datepart(hour, @cur_end_dt) = 0) and
498                           (datepart(minute, @cur_end_dt) = 0) and
499                           (datepart(second, @cur_end_dt) = 0)))
500                   and
501                   (@end_dt > @cur_start_dt)
502               begin
503                   /*
504                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
505                   */
506                   raiserror 18212, @current_range
507                   return (1)
508               end
509   
510               /* This is the non-wrapping case, where
511               ** the limit's timerange completely
512               ** covers the current range.
513               */
514               if
515                   (@cur_startdaynum <= @cur_enddaynum)
516                   and
517                   (((@startdaynum >= @cur_startdaynum) and
518                           (@startdaynum <= @cur_enddaynum)) or
519                       ((@enddaynum >= @cur_startdaynum) and
520                           (@enddaynum <= @cur_enddaynum)) or
521                       ((@startdaynum <= @cur_startdaynum) and
522                           (@enddaynum >= @cur_enddaynum)))
523                   and
524                   (@start_dt < @cur_start_dt)
525                   and
526                   (((@end_dt > @cur_end_dt) and
527                           ((datepart(hour, @cur_end_dt) != 0) or
528                               (datepart(minute, @cur_end_dt) != 0) or
529                               (datepart(second, @cur_end_dt) != 0)))
530                       or
531                       ((datepart(hour, @end_dt) = 0) and
532                           (datepart(minute, @end_dt) = 0) and
533                           (datepart(second, @end_dt) = 0)))
534               begin
535                   /*
536                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
537                   */
538                   raiserror 18212, @current_range
539                   return (1)
540               end
541   
542               /* This is the wrapping case, where
543               ** the limit's timerange completely
544               ** covers the current range.
545               */
546               if
547                   (@cur_startdaynum > @cur_enddaynum)
548                   and
549                   ((@startdaynum >= @cur_startdaynum) or
550                       (@startdaynum <= @cur_enddaynum) or
551                       (@enddaynum >= @cur_startdaynum) or
552                       (@enddaynum <= @cur_enddaynum) or
553                       ((@startdaynum > @enddaynum) and
554                           (@startdaynum <= @cur_startdaynum) and
555                           (@enddaynum >= @cur_enddaynum)))
556                   and
557                   (@start_dt < @cur_start_dt)
558                   and
559                   (((@end_dt > @cur_end_dt) and
560                           ((datepart(hour, @cur_end_dt) != 0) or
561                               (datepart(minute, @cur_end_dt) != 0) or
562                               (datepart(second, @cur_end_dt) != 0)))
563                       or
564                       ((datepart(hour, @end_dt) = 0) and
565                           (datepart(minute, @end_dt) = 0) and
566                           (datepart(second, @end_dt) = 0)))
567               begin
568                   /*
569                   ** 18212, "New limit would cause overlap with limits on range %1! for this user-application combination."
570                   */
571                   raiserror 18212, @current_range
572                   return (1)
573               end
574   
575           end
576   
577           fetch c1 into @current_range
578       end
579   
580       /* Make sure we're not adding a duplicate */
581       if exists (select * from master.dbo.sysresourcelimits
582               where
583                   /*
584                   (
585                   ((name = @name) and
586                   (appname = @appname)) or
587                   ((name = @name) and
588                   (@appname is null)) or
589                   ((@name is null) and
590                   (appname = @appname))
591                   )
592                   */
593                   name = @name
594                   and appname = @appname
595   
596                   and rangeid = @rangeid
597                   and limitid = @limitid
598                   and ((enforced & @enforced_arg) != 0)
599                   and ((scope & @scope_arg) != 0))
600       begin
601           /*
602           ** 18213, "This user/application can have only one limit for each distinct combination of time range, limit type, enforcement time and scope."
603           */
604           raiserror 18213
605           return (1)
606       end
607   
608   
609       /* Insert! */
610       insert master.dbo.sysresourcelimits values (@name, @appname, @rangeid, @limitid, @enforced_arg, @action_arg, @limitvalue, @scope_arg, 0)
611   
612   
613   
614       dbcc recachelimits
615   
616       /*
617       ** 18214, "New resource limit created."
618       */
619       exec sp_getmessage 18214, @msg output
620       print @msg
621   
622       /*
623       ** Okay, so we know that the limit has been added ...
624       ** but are resource limits enabled?
625       */
626   
627       declare @rg_status int
628       select @rg_status = s.value from
629           master.dbo.syscurconfigs s,
630           master.dbo.sysconfigures sc
631       where sc.config = s.config
632           and sc.name = "allow resource limits"
633       if (@rg_status = 0)
634       begin
635           /*
636           ** 19373, "WARNING: This limit will not take effect until resource limits
637           ** are enabled for this server. Use sp_configure 'allow resource limits', 1.
638           */
639           exec sp_getmessage 19373, @msg output
640           print @msg
641       end
642   
643       return (0)
644   
645   clean_all:
646   
647       return (1)
648   
649   


exec sp_procxmode 'sp_add_resource_limit', 'AnyMode'
go

Grant Execute on sp_add_resource_limit to public
go
DEFECTS
 MURC 6 Unreachable Code 645
 MURC 6 Unreachable Code 647
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 MTYP 4 Assignment type mismatch action: tinyint = int 610
 MTYP 4 Assignment type mismatch appname: varchar(30) = varchar(255) 610
 MTYP 4 Assignment type mismatch enforced: tinyint = int 610
 MTYP 4 Assignment type mismatch name: varchar(30) = varchar(255) 610
 MTYP 4 Assignment type mismatch scope: tinyint = int 610
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 355
 QTYP 4 Comparison type mismatch smallint = int 355
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 358
 QTYP 4 Comparison type mismatch smallint = int 358
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 363
 QTYP 4 Comparison type mismatch smallint = int 363
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 366
 QTYP 4 Comparison type mismatch smallint = int 366
 TNOI 4 Table with no index master..spt_limit_types master..spt_limit_types
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 TNOU 4 Table with no unique index master..sysresourcelimits master..sysresourcelimits
 TNOU 4 Table with no unique index master..systimeranges master..systimeranges
 CUSU 3 Cursor updated through 'searched update': risk of halloween rows c1 610
 MAW1 3 Warning message on %name% master..spt_limit_types.id: Warning message on spt_limit_types 284
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 287
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 292
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 296
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 355
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 358
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 363
 MAW1 3 Warning message on %name% master..systimeranges.id: Warning message on systimeranges 366
 MGTP 3 Grant to public master..spt_limit_types  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public master..syscurconfigs  
 MGTP 3 Grant to public master..syslogins  
 MGTP 3 Grant to public master..sysresourcelimits  
 MGTP 3 Grant to public master..systimeranges  
 MGTP 3 Grant to public sybsystemprocs..sp_add_resource_limit  
 MNER 3 No Error Check should check @@error after insert 610
 MNER 3 No Error Check should check return value of exec 619
 MNER 3 No Error Check should check return value of exec 639
 MUCO 3 Useless Code Useless Brackets 116
 MUCO 3 Useless Code Useless Brackets 119
 MUCO 3 Useless Code Useless Brackets 127
 MUCO 3 Useless Code Useless Brackets 129
 MUCO 3 Useless Code Useless Brackets 136
 MUCO 3 Useless Code Useless Brackets 137
 MUCO 3 Useless Code Useless Brackets 145
 MUCO 3 Useless Code Useless Brackets 148
 MUCO 3 Useless Code Useless Brackets 154
 MUCO 3 Useless Code Useless Brackets 158
 MUCO 3 Useless Code Useless Brackets 166
 MUCO 3 Useless Code Useless Brackets 173
 MUCO 3 Useless Code Useless Brackets 179
 MUCO 3 Useless Code Useless Brackets 188
 MUCO 3 Useless Code Useless Brackets 192
 MUCO 3 Useless Code Useless Brackets 198
 MUCO 3 Useless Code Useless Brackets 207
 MUCO 3 Useless Code Useless Brackets 211
 MUCO 3 Useless Code Useless Brackets 217
 MUCO 3 Useless Code Useless Brackets 219
 MUCO 3 Useless Code Useless Brackets 225
 MUCO 3 Useless Code Useless Brackets 230
 MUCO 3 Useless Code Useless Brackets 234
 MUCO 3 Useless Code Useless Brackets 240
 MUCO 3 Useless Code Useless Brackets 248
 MUCO 3 Useless Code Useless Brackets 252
 MUCO 3 Useless Code Useless Brackets 258
 MUCO 3 Useless Code Useless Brackets 266
 MUCO 3 Useless Code Useless Brackets 270
 MUCO 3 Useless Code Useless Brackets 276
 MUCO 3 Useless Code Useless Brackets 308
 MUCO 3 Useless Code Useless Brackets 314
 MUCO 3 Useless Code Useless Brackets 319
 MUCO 3 Useless Code Useless Brackets 325
 MUCO 3 Useless Code Useless Brackets 346
 MUCO 3 Useless Code Useless Brackets 349
 MUCO 3 Useless Code Useless Brackets 413
 MUCO 3 Useless Code Useless Brackets 440
 MUCO 3 Useless Code Useless Brackets 480
 MUCO 3 Useless Code Useless Brackets 507
 MUCO 3 Useless Code Useless Brackets 539
 MUCO 3 Useless Code Useless Brackets 572
 MUCO 3 Useless Code Useless Brackets 605
 MUCO 3 Useless Code Useless Brackets 633
 MUCO 3 Useless Code Useless Brackets 643
 MUCO 3 Useless Code Useless Brackets 647
 QAFM 3 Var Assignment from potentially many rows 250
 QAFM 3 Var Assignment from potentially many rows 268
 QAFM 3 Var Assignment from potentially many rows 284
 QAFM 3 Var Assignment from potentially many rows 287
 QAFM 3 Var Assignment from potentially many rows 291
 QAFM 3 Var Assignment from potentially many rows 295
 QAFM 3 Var Assignment from potentially many rows 299
 QAFM 3 Var Assignment from potentially many rows 303
 QAFM 3 Var Assignment from potentially many rows 353
 QAFM 3 Var Assignment from potentially many rows 356
 QAFM 3 Var Assignment from potentially many rows 361
 QAFM 3 Var Assignment from potentially many rows 364
 QAFM 3 Var Assignment from potentially many rows 628
 QGWO 3 Group by/Distinct/Union without order by 332
 QNAJ 3 Not using ANSI Inner Join 628
 QPNC 3 No column in condition 334
 QPNC 3 No column in condition 337
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {name}
632
 QSWV 3 Sarg with variable @rangeid, Candidate Index: systimeranges.csystimeranges clustered(id) F 292
 QSWV 3 Sarg with variable @rangeid, Candidate Index: systimeranges.csystimeranges clustered(id) F 296
 QSWV 3 Sarg with variable @current_range, Candidate Index: systimeranges.csystimeranges clustered(id) F 355
 QSWV 3 Sarg with variable @current_range, Candidate Index: systimeranges.csystimeranges clustered(id) F 358
 QSWV 3 Sarg with variable @current_range, Candidate Index: systimeranges.csystimeranges clustered(id) F 363
 QSWV 3 Sarg with variable @current_range, Candidate Index: systimeranges.csystimeranges clustered(id) F 366
 QSWV 3 Sarg with variable @rangeid, Candidate Index: sysresourcelimits.csysresourcelimits clustered(name, appname) S 596
 QSWV 3 Sarg with variable @limitid, Candidate Index: sysresourcelimits.csysresourcelimits clustered(name, appname) S 597
 QTLO 3 Top-Level OR 333
 VNRD 3 Variable is not read @dummy 123
 CRDO 2 Read Only Cursor Marker (has a 'distinct' option) 332
 MSUB 2 Subquery Marker 159
 MSUB 2 Subquery Marker 182
 MSUB 2 Subquery Marker 201
 MSUB 2 Subquery Marker 252
 MSUB 2 Subquery Marker 270
 MSUB 2 Subquery Marker 581
 MTR1 2 Metrics: Comments Ratio Comments: 45% 73
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 106 = 128dec - 24exi + 2 73
 MTR3 2 Metrics: Query Complexity Complexity: 309 73
 PRED_QUERY_COLLECTION 2 {c=master..sysconfigures, c2=master..syscurconfigs} 0 628

DATA PROPAGATION detailed
ColumnWritten To
@actionsysresourcelimits.action   sp_drop_time_range_rset_001.action
@appnamesysresourcelimits.appname   sp_drop_time_range_rset_001.appname
@enforcedsysresourcelimits.enforced   sp_drop_time_range_rset_001.enforced
@limitvaluesysresourcelimits.limitvalue   sp_drop_time_range_rset_001.limitvalue
@namesysresourcelimits.name   sp_drop_time_range_rset_001.name
@scopesysresourcelimits.scope   sp_drop_time_range_rset_001.scope

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_getmessage  
   reads table sybsystemprocs..sysusermessages  
   reads table master..sysmessages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..syslanguages (1)  
calls proc sybsystemprocs..sp_ha_check_certified  
   reads table tempdb..sysobjects (1)  
reads table master..syslogins (1)  
reads table master..spt_limit_types (1)  
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)  
reads table master..systimeranges (1)  
read_writes table master..sysresourcelimits (1)  
reads table master..syscurconfigs (1)  
reads table master..sysconfigures (1)