DatabaseProcApplicationCreatedLinks
sybsystemprocssp_dboption  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/a_values */
4     
5     /*
6     ** Messages for "sp_dboption"           17420
7     **      Use "langid" when looking at spt_values ???
8     **
9     ** 17260, "Can't run %1! from within a transaction." 
10    ** 17420, "Settable database options."
11    ** 17421, "No such database -- run sp_helpdb to list databases."
12    ** 17422, "The 'master' database's options cannot be changed."
13    ** 17423, "Usage: sp_dboption [dbname, optname, {true | false}]"
14    ** 17424, "The database option does not exist or you cannot set the option."
15    ** 17425, "Run sp_dboption with no parameters to see options."
16    ** 17426, "Database option is not unique."
17    ** 17428, "You must be in the 'master' database in order to change
18    **	database options."                                
19    ** 17430, "Run the CHECKPOINT command in the database that was changed."
20    ** 17431, "true"
21    ** 17432, "false"
22    ** 17433, "Database option '%1!' turned ON for database '%2!'."
23    ** 17434, "Database option '%1!' turned OFF for database '%2!'."
24    ** 17289, "Set your curwrite to the hurdle of current database."
25    ** 17436, "You cannot set the '%1!' option for a temporary database"
26    ** 17439, "You cannot turn on ''%1!' for '%2!' because it is an HA server 
27    ** 	that has been configured with the proxy_db option."
28    ** 18974, "Warning: Attempting to change database options for a 
29    ** 	   temporary database. Database options must be kept consistent
30    ** 	   across all temporary databases."
31    ** 19015, "The 'async log service' option is only valid for configurations 
32    **	   with more than 4 engines online."
33    ** 19112, "Running CHECKPOINT on database '%1!' for option '%2!' to take effect."
34    ** 19113, "CHECKPOINT command failed. Run the CHECKPOINT command in database '%1!' for the 
35    **         change to take effect."
36    ** 19424, "Cannot run '%1!' on an archive database."
37    ** 19884, "You cannot set the '%1!' option to '%2!' for a temporary database."
38    ** 19518, "Warning: Attempting to change database options for a local
39    **         temporary database. Database options must be kept consistent
40    **         across all local temporary databases."
41    ** 19886, "Please execute DUMP DATABASE before executing DUMP TRANSACTION."
42    ** 19892, "DUMP TRANSACTION is not allowed when '%1!' is ON. Use DUMP DATABASE
43    **	   or DUMP TRANSACTION ... WITH TRUNCATE_ONLY or WITH NO_LOG instead."
44    ** 19987, "You cannot set the '%1!' option for temporary databases or for 
45    **	   databases with durability %2!"
46    ** 17938, "You cannot set the '%1!' database option for the in-memory database '%2!'."
47    ** 17939, "The option '%1!' has been set in database '%2!' but will be ignored 
48    	   until you change the durability of the database to FULL."
49    ** 17952, "The option '%1!' applies only to databases with a segregated log.
50    **         The option has been set in database '%2!' but will be ignored while 
51    **	   the log and data segments remain mixed."
52    ** 17954, "You cannot set the '%1!' database option to true when the '%2!' 
53    **	   database option is on for database '%3!'."
54    ** 17955, "You cannot set the '%1!' database option for the read-only 
55    **	   database '%2!'."
56    ** 17956, "You cannot set the '%1!' database option for database '%2!'
57    **	   because it has been brought online for standby access."
58    ** 17957, "You cannot set the '%1!' database option because the database 
59    **	   '%2!' is either marked as needing a database dump, an unlogged
60    **	   operation was performed or the transaction log was truncated. Dump
61    **	   the database, then retry setting the option."
62    ** 17958, "The database options 'select into/bulkcopy/pllsort' or 'trunc log
63    **	   on chkpt' are invalid when the '%1!' database option is set to 
64    **	   true. These options will be turned off for database '%2!'."
65    ** 17899, "The asynchronous initializer thread was running and it has been 
66    **	   terminated."
67    ** 17908, "The asynchronous initializer thread has been started."
68    ** 19988, "deallocate first text page."
69    ** 17173, "The '%1!' option is not valid in Cluster Edition."
70    ** 17190, "You cannot set the '%1' option for a proxy database."
71    ** 17198, "The 'async log service' option can only be set to true for configurations that have a 'user log cache queue size' set to '0'."
72    */
73    
74    create or replace procedure sp_dboption
75        @dbname varchar(30) = NULL, /* database name to change */
76        @optname varchar(36) = NULL, /* option name to turn on/off */
77        @optvalue varchar(10) = NULL, /* true or false */
78        @dockpt tinyint = 1 /* 
79    					** 0 indicates don't run checkpoint 
80    					** else run checkpoint automatically
81    					*/
82    as
83    
84        declare @dbid int, /* dbid of the database */
85            @dbuid int, /* id of the owner of the database */
86            @statvalue int, /* number of option */
87            @stattype char(2), /* status field flag */
88            @statopt smallint, /* option mask, part 1 */
89            @stat2opt smallint, /* option mask, part 2 */
90            @stat3opt int, /* option mask, part 3 */
91            @stat4opt int, /* option mask, part 4 */
92            @stat5opt int, /* option mask, part 5 */
93            @optcount int, /* number of options like @optname */
94            @success_msg varchar(1024), /* success status message */
95            @msg varchar(1024),
96            @sptlang int,
97            @retstat int,
98            @true varchar(10),
99            @false varchar(10),
100           @whichone int, /* which language? */
101           @optmsgnum int, /* identify one msgnum to compare */
102           @msgcnt int, /* count distinct dups */
103           @tempdb_mask int, /* all tempdb status bits */
104           @local_tempdb_mask int, /* all local tempdb status bits */
105           @isatempdb int, /* changing options on a temp. db ? */
106           @isinmemdb int, /* changing options on inmemory db ? */
107           @issystemdb int, /* changing options on system db ? */
108           @isproxydb int, /* changing options on proxy db ? */
109           @ismixedlog int, /* does database have mixed log,data */
110           @engines int, /* Get the number of engines */
111           @isarchivedb int, /* Is this an archive database? */
112           @DMPX_NOTOK_NONLOGGED_WRITES int, /* Same definition as in dmpld.h */
113           @DMPX_NOTOK_TRUNCATED_ONLY int, /* Same definition as in dmpld.h */
114           @durability varchar(30),
115           @dur int,
116           @tran_status int, /* status returned from
117           ** tran_dumpable_status().
118           */
119           @selbulk int, /* status of
120           ** "select into/bulkcopy/pllsort"
121           ** option.
122           */
123           @enforcedumptranseq
124           int, /* status of "enforce dump tran
125           ** sequence" option.
126           */
127   
128           @on int,
129           @error int,
130           @msgno int,
131           @max_msg_len int,
132           @max_name_len int,
133           @sqlstr varchar(1200),
134           @flstr char(17),
135           @nullarg char(1),
136           @dummy int,
137           @status int,
138           @gp_enabled int,
139           @cha_area varchar(10), /* for configuration history auditing */
140           @cha_type varchar(30),
141           @cha_target varchar(30),
142           @cha_element varchar(255),
143           @cha_oldvalue varchar(255),
144           @cha_newvalue varchar(255),
145           @cha_mode varchar(10),
146           @cha_instanceid int,
147           @cha_ret int,
148           @old_value int,
149           @ulcqueuesize int,
150           @ulcqueuesize_cc int
151   
152   
153       if @@trancount = 0
154       begin
155           set chained off
156       end
157   
158       select @sptlang = @@langid, @whichone = 0, @isatempdb = 0, @isarchivedb = 0,
159           @issystemdb = 0, @isinmemdb = 0, @retstat = 0, @dur = 1,
160           @flstr = "full logging for "
161   
162       if @@langid != 0
163       begin
164           if not exists (
165                   select * from master.dbo.sysmessages where error
166                       between 17050 and 17069
167                       and langid = @@langid)
168               select @sptlang = 0
169       end
170   
171       /*
172       **  If no @dbname given, just list the possible dboptions.
173       **  Only certain status bits may be set or cleared.  
174       **	   settable                	    not settable
175       **      ------------------------------  --------------------------
176       **	allow select into/bulkcopy (4)	don't recover (32)
177       **	truncate log on checkpoint (8)	not recovered (256)
178       **	no checkpoint on recovery (16)
179       **	ddl in tran (512)
180       **	read only (1024)
181       **	dbo use only (2048)
182       **	single user (4096)
183       **	allow null (8192)
184       **      ALL SETTABLE OPTIONS (15900)
185       **	abort xact on log full (1, type='D2')
186       **	no space accounting (2, type='D2')
187       **	auto identity(4, type='D2')
188       **	identity in nonunique index(8, type='D2')
189       **	auto identity unique index(64, type='D2')
190       **	async log service	  (1024 type='D3')
191       **	delayed commit   	  (2048 type='D3')
192       **      scratch database (16777216 type='D3')
193       ** 	deferred table allocation (4194304 type='D4')
194       **	allow incremental dumps (536870912 type = 'D4'
195       ** 	deallocate first text page(-2147483648 type='D4')
196       **	erase residual data (16384 type="D")
197       **
198       **	off-sysdatabases options (type = 'D')
199       **	------------------------------------
200       **	select into		(0x00000001)
201       **	alter table		(0x00000004)
202       **	reorg rebuild		(0x00000008)
203       */
204   
205       /*
206       ** Look for the "settable options" mask in spt_values
207       */
208       select @statopt = number
209       from master.dbo.spt_values
210       where type = "D"
211           and name = "ALL SETTABLE OPTIONS"
212   
213       select @stat2opt = number
214       from master.dbo.spt_values
215       where type = "D2"
216           and name = "ALL SETTABLE OPTIONS"
217   
218       select @stat3opt = number
219       from master.dbo.spt_values
220       where type = "D3"
221           and name = "ALL SETTABLE OPTIONS"
222   
223       select @stat4opt = number
224       from master.dbo.spt_values
225       where type = "D4"
226           and name = "ALL SETTABLE OPTIONS"
227   
228       select @stat5opt = number
229       from master.dbo.spt_values
230       where type = "D5"
231           and name = "ALL SETTABLE OPTIONS"
232   
233       /*
234       ** If we can't find the option masks, guess at them
235       */
236       if @statopt is null
237           select @statopt = 4 | 8 | 16 | 512 | 1024 | 2048 | 4096 | 8192 | 16384
238       if @stat2opt is null
239           select @stat2opt = 1 | 2 | 4 | 8 | 64
240       if @stat3opt is null
241           select @stat3opt = 1024 | 2048 | 16777216
242       if @stat4opt is null
243           select @stat4opt = 32768 | 4194304 | 536870912 | - 2147483648
244       if @stat5opt is null
245           select @stat5opt = 0
246   
247       if @dbname is null
248       begin
249           exec sp_getmessage 17420, @msg output
250           print @msg
251   
252           /* Compute the maximum length of the dboption name */
253           select @max_name_len = max(datalength(name))
254           from master.dbo.spt_values
255           where ((type = "D"
256                       and number & @statopt = number
257                       and number & @statopt != @statopt)
258                   or (type = "D2"
259                       and number & @stat2opt = number
260                       and number & @stat2opt != @stat2opt)
261                   or (type = "D3"
262                       and number & @stat3opt = number
263                       and name != "ALL SETTABLE OPTIONS")
264                   or (type = "D4"
265                       and number & @stat4opt = number
266                       and name != "ALL SETTABLE OPTIONS")
267                   or (type = "D5"
268                       and number & @stat5opt = number
269                       and name != "ALL SETTABLE OPTIONS"))
270   
271           if @sptlang = 0
272           begin
273               /* Use the above computed length in our select query */
274               select @sqlstr =
275                   "select database_options = convert(char("
276                   + convert(varchar, @max_name_len)
277                   + "), name)
278   		from master.dbo.spt_values
279   		where ((type = 'D'
280   			and number & @statopt = number
281   			and number & @statopt != @statopt)
282   		    or (type = 'D2'
283   			and number & @stat2opt = number
284   			and number & @stat2opt != @stat2opt)
285   		    or (type = 'D3'
286   			and number & @stat3opt = number
287   			and name != 'ALL SETTABLE OPTIONS')
288   		    or (type = 'D4'
289   			and number & @stat4opt = number
290   			and name != 'ALL SETTABLE OPTIONS')
291   		    or (type = 'D5'
292   			and number & @stat5opt = number
293   			and name != 'ALL SETTABLE OPTIONS'))
294   	    union
295   	    select database_options = convert(char(32), @flstr + char_value)
296   		from master.dbo.sysattributes
297   		where class = 38 and object = 1
298   	    order by 1"
299               /* Now execute the formulated SQL statement */
300               exec (@sqlstr)
301           end
302           else
303           begin
304               /* Compute the maximum length of the dboption message text */
305               select @max_msg_len = max(datalength(description))
306               from master.dbo.spt_values, master.dbo.sysmessages
307               where ((type = "D"
308                           and number & @statopt = number
309                           and number & @statopt != @statopt)
310                       or (type = "D2"
311                           and number & @stat2opt = number
312                           and number & @stat2opt != @stat2opt)
313                       or (type = "D3"
314                           and number & @stat3opt = number
315                           and name != "ALL SETTABLE OPTIONS")
316                       or (type = "D4"
317                           and number & @stat4opt = number
318                           and name != "ALL SETTABLE OPTIONS")
319                       or (type = "D5"
320                           and number & @stat5opt = number
321                           and name != "ALL SETTABLE OPTIONS"))
322                   and msgnum = error
323                   and langid = @sptlang
324   
325               /* Use the above computed length in our select query */
326               select @sqlstr =
327                   "select database_options = convert(char("
328                   + convert(varchar, @max_name_len)
329                   + "), name), convert(char("
330                   + convert(varchar, @max_msg_len)
331                   + "), description)
332                   from master.dbo.spt_values, master.dbo.sysmessages
333                   where ((type = 'D'
334                           and number & @statopt = number
335                           and number & @statopt != @statopt)
336                       or (type = 'D2'
337                           and number & @stat2opt = number
338                           and number & @stat2opt != @stat2opt)
339                       or (type = 'D3'
340                           and number & @stat3opt = number
341                           and name != 'ALL SETTABLE OPTIONS')
342                       or (type = 'D4'
343                           and number & @stat4opt = number
344                           and name != 'ALL SETTABLE OPTIONS')
345                       or (type = 'D5'
346                           and number & @stat5opt = number
347                           and name != 'ALL SETTABLE OPTIONS'))
348                      and msgnum = error
349                      and langid = @sptlang
350   	    union
351   	    select database_options = convert(char(32), @flstr + char_value), ''
352   		from master.dbo.sysattributes
353   		where class = 38 and object = 1
354               order by 1"
355               /* Now execute the formulated SQL statement */
356               exec (@sqlstr)
357           end
358   
359           return (0)
360       end
361   
362       set transaction isolation level 1
363   
364       /*
365       **  Verify the database name and get @dbid, @dbuid and @ismixedlog
366       **  status.
367       */
368       select @dbid = dbid, @dbuid = suid,
369           @ismixedlog = status2 & 32768,
370           @isproxydb = status3 & 3,
371           @isinmemdb = status4 & 4096,
372           @dur = durability
373       from master.dbo.sysdatabases
374       where name = @dbname
375   
376       /* If @dbname not found, say so. */
377       if @dbid is NULL
378       begin
379           raiserror 17421
380           return (1)
381       end
382   
383       /* 
384       ** If granular permissions is not enabled then either DBO or sa_role is 
385       ** required.
386       ** If granular permissions is enabled then the permission 'own database'
387       ** is required.  proc_role and proc_auditperm will also do auditing
388       ** if required. Both will also print error message if required.
389       */
390   
391       select @nullarg = NULL
392       execute @status = sp_aux_checkroleperm "sa_role", "own database",
393           @dbname, @gp_enabled output
394   
395       if (@gp_enabled = 0)
396       begin
397           if ((suser_id() != @dbuid))
398           begin
399               /* For Auditing */
400               if (proc_role("sa_role") = 0)
401               begin
402                   return (1)
403               end
404           end
405           else
406           begin
407               /* If DBO, then we don't need sa_role. */
408               select @status = 0
409           end
410       end
411       else
412       begin
413           select @dummy = proc_auditperm("own database", @status, @dbname)
414       end
415   
416       if (@status != 0)
417           return (1)
418   
419       /*
420       **  You can not change any of the options in master.  If the user tries to
421       **  do so tell them they can't.
422       */
423       if @dbid = 1
424       begin
425           raiserror 17422
426           return (1)
427       end
428   
429       /* 
430       ** To update master tables we should be in the master database,
431       ** otherwise, if the database where the transaction starts becomes
432       ** unrecoverable, we could have problems in the recovery of master itself.
433       */
434       if db_name() != "master"
435       begin
436           raiserror 17428
437           return (1)
438       end
439   
440       exec sp_getmessage 17431, @true out
441       exec sp_getmessage 17432, @false out
442   
443       if @optname is NULL or lower(@optvalue) not in
444           ("true", "false", @true, @false) or @optvalue is null
445       begin
446           raiserror 17423
447           return (1)
448       end
449   
450       if lower(@optvalue) in ("true", @true)
451           select @on = 1, @msgno = 17433
452       else
453           select @on = 0, @msgno = 17434
454   
455       if lower(@optname) like "full logging for%"
456       begin
457           select @success_msg = @optname
458   
459           if (@isinmemdb != 0)
460           begin
461               raiserror 17938, @success_msg, @dbname
462               return 1
463           end
464   
465           /* 
466           ** Trim the 'full logging for' prefix to pass
467           ** the actual option to sp_dboption_flmode
468           */
469           select @optname = ltrim(substring(@optname, 18, datalength(@optname) - 17))
470           exec @retstat = sp_dboption_flmode @dbname, @optname, @optvalue
471   
472           if @retstat = 0
473           begin
474               if (@on = 1)
475               begin
476                   if (@dur > 1)
477                       select @error = 17939
478                   else if (@ismixedlog = 32768)
479                       select @error = 17952
480                   else
481                       select @error = 0
482   
483                   if (@error != 0)
484                   begin
485                       exec sp_getmessage @error, @msg output
486                       print @msg, @success_msg, @dbname
487                   end
488               end
489               goto print_and_ckpt
490           end
491   
492           return @retstat
493       end
494   
495       /*
496       ** Determine if we are changing options for a temporary database.
497       */
498       select @tempdb_mask = number
499       from master.dbo.spt_values
500       where type = "D3" and name = "TEMPDB STATUS MASK"
501   
502       if (@dbname in ("master", "model", "sybsystemdb",
503                   "sybsystemprocs", "sybsecurity", "dbccdb",
504                   "dbccalt", "sybsyntax"))
505       begin
506           select @issystemdb = 1
507       end
508       else
509       if (@dbid = 2) or exists (select * from master.dbo.sysdatabases
510               where dbid = @dbid
511                   and (status3 & @tempdb_mask) != 0)
512       begin
513           select @isatempdb = 1
514       end
515       else
516       if exists (select * from master.dbo.sysdatabases
517               where dbid = @dbid
518                   and (status3 & 4194304) = 4194304)
519       begin
520           select @isarchivedb = 1
521       end
522   
523       select @durability = db_attr(@dbid, "durability")
524   
525       /*
526       ** If attempting to change the options for a temporary database, the user
527       ** should be warned that database options across all temporary databases
528       ** should be kept consistent.
529       */
530       select @local_tempdb_mask = 0
531   
532       if (@@clustermode != "shared disk cluster" and @isatempdb = 1)
533       begin
534           exec sp_getmessage 18974, @msg output
535           print @msg
536       end
537       else if (@@clustermode = "shared disk cluster")
538       begin
539           select @local_tempdb_mask = number
540           from master.dbo.spt_values
541           where type = "D3" and name = "LOCAL TEMPDB STATUS MASK"
542   
543           if exists (select * from master.dbo.sysdatabases
544                   where dbid = @dbid
545                       and (status3 & @local_tempdb_mask) != 0)
546           begin
547               /*
548               ** In SDC, #table appears only in local tempdbs, global tempdb
549               ** is mostly like the regular databases, dboptions doesn't
550               ** need to be same among global tempdbs.
551               **
552               ** 19518, "Warning: Attempting to change database options for a
553               **	   local temporary database. Database options must be
554               **	   kept consistent across all local temporary 
555               **	   databases."
556               */
557               exec sp_getmessage 19518, @msg output
558               print @msg
559           end
560       end
561   
562       /*
563       **  Use @optname and try to find the right option.
564       **  If there isn't just one, print appropriate diagnostics and return.
565       */
566       select @optcount = count(*)
567       from master.dbo.spt_values
568       where name like "%" + @optname + "%"
569           and ((type = "D"
570                   and number & @statopt = number)
571               or (type = "D2"
572                   and number & @stat2opt = number)
573               or (type = "D3"
574                   and number & @stat3opt = number)
575               or (type = "D4"
576                   and number & @stat4opt = number)
577               or (type = "D5"
578                   and number & @stat5opt = number))
579       /*
580       **  If more than one option like @optname, make sure they are not the same
581       **  option ("trunc" and "trunc.", for example)
582       */
583       if @optcount > 1
584       begin
585           select @optmsgnum = msgnum
586           from master.dbo.spt_values
587           where name like "%" + @optname + "%"
588               and ((type = "D"
589                       and number & @statopt = number)
590                   or (type = "D2"
591                       and number & @stat2opt = number)
592                   or (type = "D3"
593                       and number & @stat3opt = number)
594                   or (type = "D4"
595                       and number & @stat4opt = number)
596                   or (type = "D5"
597                       and number & @stat5opt = number))
598   
599           select @msgcnt = count(msgnum)
600           from master.dbo.spt_values
601           where name like "%" + @optname + "%"
602               and ((type = "D"
603                       and number & @statopt = number)
604                   or (type = "D2"
605                       and number & @stat2opt = number)
606                   or (type = "D3"
607                       and number & @stat3opt = number)
608                   or (type = "D4"
609                       and number & @stat4opt = number)
610                   or (type = "D5"
611                       and number & @stat5opt = number))
612               and msgnum != @optmsgnum
613   
614           /* 
615           ** msgcnt of 0 indicates we really have just 1 unique dboption, 
616           ** probably due to alternate spelling.
617           */
618           if (@msgcnt = 0)
619               select @optcount = 1
620       end
621       /*
622       ** If no option, and alternate language is set, use other language
623       */
624       if @optcount = 0 and @sptlang != 0
625       begin
626           select @optcount = count(*)
627           from master.dbo.spt_values, master.dbo.sysmessages
628           where description like "%" + @optname + "%"
629               and ((type = "D"
630                       and number & @statopt = number)
631                   or (type = "D2"
632                       and number & @stat2opt = number)
633                   or (type = "D3"
634                       and number & @stat3opt = number)
635                   or (type = "D4"
636                       and number & @stat4opt = number)
637                   or (type = "D5"
638                       and number & @stat5opt = number))
639               and msgnum = error
640               and langid = @sptlang
641           select @whichone = 1
642           /*
643           **  If more than one option like @optname, make sure they are not the same
644           **  option ("trunc" and "trunc.", for example)
645           */
646           if @optcount > 1
647           begin
648               select @optmsgnum = msgnum
649               from master.dbo.spt_values, master.dbo.sysmessages
650               where description like "%" + @optname + "%"
651                   and ((type = "D"
652                           and number & @statopt = number)
653                       or (type = "D2"
654                           and number & @stat2opt = number)
655                       or (type = "D3"
656                           and number & @stat3opt = number)
657                       or (type = "D4"
658                           and number & @stat4opt = number)
659                       or (type = "D5"
660                           and number & @stat5opt = number))
661                   and msgnum = error
662                   and langid = @sptlang
663   
664               select @msgcnt = count(msgnum)
665               from master.dbo.spt_values, master.dbo.sysmessages
666               where description like "%" + @optname + "%"
667                   and ((type = "D"
668                           and number & @statopt = number)
669                       or (type = "D2"
670                           and number & @stat2opt = number)
671                       or (type = "D3"
672                           and number & @stat3opt = number)
673                       or (type = "D4"
674                           and number & @stat4opt = number)
675                       or (type = "D5"
676                           and number & @stat5opt = number))
677                   and msgnum = error
678                   and langid = @sptlang
679                   and msgnum != @optmsgnum
680   
681               /* 
682               ** msgcnt of 0 indicates we really have just 1 unique dboption, 
683               ** probably due to alternate spelling.
684               */
685               if (@msgcnt = 0)
686                   select @optcount = 1
687           end
688       end
689   
690       /*
691       **  If no option, show the user what the options are.
692       */
693       if @optcount = 0
694       begin
695           raiserror 17424
696   
697           exec sp_getmessage 17425, @msg output
698           print @msg
699           return (1)
700       end
701   
702       /*
703       **  If more than one option like @optname, show the duplicates and return.
704       */
705       if @optcount > 1
706       begin
707           raiserror 17426
708   
709           if @sptlang = 0
710               select duplicate_options = name
711               from master.dbo.spt_values
712               where name like "%" + @optname + "%"
713                   and ((type = "D"
714                           and number & @statopt = number)
715                       or (type = "D2"
716                           and number & @stat2opt = number)
717                       or (type = "D3"
718                           and number & @stat3opt = number)
719                       or (type = "D4"
720                           and number & @stat4opt = number)
721                       or (type = "D5"
722                           and number & @stat5opt = number))
723           else
724               select duplicate_options = name, convert(char(22), description)
725               from master.dbo.spt_values, master.dbo.sysmessages
726               where (name like "%" + @optname + "%"
727                       or description like "%" + @optname + "%")
728                   and ((type = "D"
729                           and number & @statopt = number)
730                       or (type = "D2"
731                           and number & @stat2opt = number)
732                       or (type = "D3"
733                           and number & @stat3opt = number)
734                       or (type = "D4"
735                           and number & @stat4opt = number)
736                       or (type = "D5"
737                           and number & @stat5opt = number))
738                   and msgnum = error
739                   and langid = @sptlang
740   
741           return (1)
742       end
743   
744       /*
745       ** User cannot set a temporary  database in single user mode or as a scratch 
746       ** database.
747       */
748       select @statvalue = number
749       from master.dbo.spt_values
750       where name like "%" + @optname + "%"
751           and ((type = "D"
752                   and number & @statopt = number)
753               or (type = "D2"
754                   and number & @stat2opt = number)
755               or (type = "D3"
756                   and number & @stat3opt = number)
757               or (type = "D4"
758                   and number & @stat4opt = number)
759               or (type = "D5"
760                   and number & @stat5opt = number))
761   
762       if (@isatempdb = 1) and ((@statvalue & (4096 | 16777216)) != 0)
763       begin
764           raiserror 17436, @optname
765           return (1)
766       end
767   
768       /* disallow turning off the 'select into' option for a temporary database. */
769       if (@isatempdb = 1)
770           and (@statvalue = 4)
771           and (lower(@optvalue) in ('false', @false))
772       begin
773           raiserror 19884, @optname, @false
774           return (1)
775       end
776       /* 
777       ** Only the 'single user option' may be changed in an archive database.
778       */
779       if (@isarchivedb = 1) and (@statvalue != 4096)
780       begin
781           raiserror 19424, "sp_dboption"
782           return (1)
783       end
784   
785       /*
786       **  If we're in a transaction, disallow this since it might make recovery
787       **  impossible.
788       */
789       if @@trancount > 0
790       begin
791           raiserror 17260, "sp_dboption"
792           return (1)
793       end
794       else
795       begin
796           set chained off
797       end
798   
799       set transaction isolation level 1
800   
801       /*
802       **  Get the number which is the bit value to set
803       */
804       if @whichone = 0
805           select @statvalue = number, @stattype = type, @success_msg = name
806           from master.dbo.spt_values
807           where name like "%" + @optname + "%"
808               and ((type = "D"
809                       and number & @statopt = number)
810                   or (type = "D2"
811                       and number & @stat2opt = number)
812                   or (type = "D3"
813                       and number & @stat3opt = number)
814                   or (type = "D4"
815                       and number & @stat4opt = number)
816                   or (type = "D5"
817                       and number & @stat5opt = number))
818       else
819           select @statvalue = number, @stattype = type, @success_msg = name
820           from master.dbo.spt_values, master.dbo.sysmessages
821           where description like "%" + @optname + "%"
822               and ((type = "D"
823                       and number & @statopt = number)
824                   or (type = "D2"
825                       and number & @stat2opt = number)
826                   or (type = "D3"
827                       and number & @stat3opt = number)
828                   or (type = "D4"
829                       and number & @stat4opt = number)
830                   or (type = "D5"
831                       and number & @stat5opt = number))
832               and msgnum = error
833               and langid = @sptlang
834   
835       /*
836       ** We do not allow 'sybsecurity' to be set to 'single user' since,
837       ** if auditing is enabled and we try to set 'sybsecurity' database to
838       ** 'single user' then, the audit process is killed because audit process
839       ** tries to do 'usedb' and it fails (look at utils/auditing.c).
840       */
841       if (@dbname = "sybsecurity") and (@statvalue = 4096)
842       begin
843           /*
844           ** 17435, "The 'single user' option is not valid for the
845           ** 'sybsecurity' database.
846           */
847           raiserror 17435
848           return (1)
849       end
850   
851       /*
852       ** We do not allow Async logging services on system databases, MLD databases
853       ** or for configurations with less than 4 engines online.
854       */
855       if ((@statvalue = 1024)
856               and (@stattype = "D3")
857               and (lower(@optvalue) in ("true", @true))
858           )
859       begin
860           /* 
861           ** Not valid for master, model and systemp tempdb, user define tempdbs and
862           ** the sybsecurity database
863           */
864           if (@issystemdb = 1) or (@isatempdb = 1)
865           begin
866               /*
867               ** 18984, The 'async log service' option is not valid 
868               ** for system databases 
869               */
870               raiserror 18984, @optname
871               return (1)
872           end
873   
874           /* We don't allow this option for databases with mixed log and data */
875           if (@ismixedlog = 32768)
876           begin
877               /*
878               ** 18986, The 'async log service' option is not valid for
879               ** databases with log and data on the same device.
880               */
881               raiserror 18986, @optname
882               return (1)
883           end
884   
885           select @engines = count(engine)
886           from master.dbo.sysengines
887           where status != "offline"
888   
889           if (@engines < 4)
890           begin
891               /*
892               ** 19015, The 'async log service' option is only valid for 
893               ** configurations with at least 4 engines online.
894               */
895               raiserror 19015
896               return (1)
897           end
898   
899           /*
900           ** Check the value of configuration parameter 'user log cache
901           ** queue size' to see if we can turn on 'async log service' option.
902           ** We check the value in both sysconfigures and syscurconfigs.
903           ** Even though 'user log cache queue size' is a static parameter,
904           ** and only the value in syscurconfigs is the effective value,
905           ** we check both to make sure that if user has the intention
906           ** to set 'user log cache queue size' to greater than 0,
907           ** even if it may not take effect until next server reboot,
908           ** still do not allow user to turn on 'async log service' option.
909           */
910           select @ulcqueuesize = cf.value from master.dbo.sysconfigures cf
911           where cf.name = 'user log cache queue size'
912   
913           select @ulcqueuesize_cc = ccf.value
914           from master.dbo.sysconfigures cf,
915               master.dbo.syscurconfigs ccf
916           where cf.name = 'user log cache queue size'
917               and cf.config = ccf.config
918   
919           if ((@ulcqueuesize > 0) or (@ulcqueuesize_cc > 0))
920           begin
921               /*
922               ** 17198, "The 'async log service' option can only be set to 
923               ** true for configurations that have a 'user log cache queue 
924               ** size' set to '0'."
925               */
926               raiserror 17198
927               return (1)
928           end
929       end
930   
931       /*
932       ** For IMDB/RDDB databases disallow 'delayed commit', 'async log service'
933       ** and 'scratch database'.
934       */
935       if ((@durability in ('at_shutdown', 'no_recovery'))
936               and (@statvalue in (1024, 2048, 16777216))
937               and (@stattype = "D3")
938               and (lower(@optvalue) in ("true", @true))
939           )
940       begin
941           select @durability = upper(@durability)
942           raiserror 19987, @optname, @durability
943           return (1)
944       end
945   
946       /*
947       ** We do not allow dboptions 'deferred table allocation' and 'erase residual
948       ** data' on system databases.
949       ** We also do not allow 'deferred table allocation' option on any user defined
950       ** tempdb.
951       */
952       if (((@statvalue = 4194304) and (@stattype = "D4"))
953               or ((@statvalue = 16384) and (@stattype = "D")))
954       begin
955   
956           /* 
957           ** If a user tempdb and trying to set 'erase residual data' option then
958           ** allow the operation.
959           */
960           if (@isatempdb = 1 and ((@statvalue != 16384) or (@stattype != "D")))
961           begin
962               raiserror 17436, @optname
963               return (1)
964           end
965   
966           /* If "tempdb" and setting 'erase residual data' option throw error. */
967           if (@dbid = 2)
968           begin
969               raiserror 17436, @optname
970               return (1)
971           end
972   
973           if (@dbname in ("master", "model", "sybsystemdb", "sybsystemprocs", "sybsecurity", "dbccdb", "dbccalt", "sybsyntax"))
974           begin
975               /*
976               ** 18984, The option is not valid
977               ** for system databases.
978               */
979               raiserror 18984, @optname
980               return (1)
981           end
982   
983           /* 
984           ** If SDC server and trying to set erase residual data option then throw
985           ** error message 17173.
986           */
987           if (@@clustermode = "shared disk cluster"
988                   and ((@statvalue = 16384) and (@stattype = "D")))
989           begin
990               /*
991               ** 17173, The 'erase residual data' option is not valid in the
992               ** Adaptive Server Cluster Edition.
993               */
994               raiserror 17173, @optname
995               return (1)
996           end
997       end
998   
999       /*
1000      ** If "enforce dump tran sequence" is ON then disallow turning ON 
1001      ** "trunc log on chkpt", "select into/bulkcopy/pllsort" and 
1002      ** "read only" options.
1003      */
1004      if (((@statvalue = 4) or (@statvalue = 8) or (@statvalue = 1024))
1005              and (@stattype = "D")
1006              and (lower(@optvalue) in ('true', @true)))
1007      begin
1008          select @enforcedumptranseq = status4 & 32768
1009          from master.dbo.sysdatabases
1010          where dbid = @dbid
1011  
1012          if (@enforcedumptranseq = 32768)
1013          begin
1014              raiserror 17954, @optname, "enforce dump tran sequence", @dbname
1015              return (1)
1016          end
1017      end
1018  
1019      /*
1020      ** We do not allow "enforce dump tran sequence" option if...
1021      */
1022      if (@statvalue = 32768) and (@stattype = "D4")
1023      begin
1024          /*
1025          ** ... database is a temporary database.
1026          */
1027          if (@isatempdb = 1)
1028          begin
1029              raiserror 17436, @optname
1030              return (1)
1031          end
1032  
1033          select @tran_status = tran_dumpable_status(@dbname)
1034  
1035          /*
1036          ** ... database is a MLD database.
1037          */
1038          if ((@tran_status & 2 = 2) or (@tran_status & 4 = 4))
1039          begin
1040              raiserror 18986, @optname
1041              return (1)
1042          end
1043  
1044          /*
1045          ** ... database has "at_shutdown" or "no_recovery" durability.
1046          */
1047          if (@tran_status & 128 = 128)
1048          begin
1049              select @durability = upper(@durability)
1050              raiserror 19987, @optname, @durability
1051              return (1)
1052          end
1053  
1054          /*
1055          ** ... database is a read-only database.
1056          */
1057          if (@tran_status & 256 = 256)
1058          begin
1059              raiserror 17955, @optname, @dbname
1060              return (1)
1061          end
1062  
1063          /*
1064          ** ... database has been brought onlinne for standby access.
1065          */
1066          if (@tran_status & 512 = 512)
1067          begin
1068              raiserror 17956, @optname, @dbname
1069              return (1)
1070          end
1071  
1072          /*
1073          ** ... database is an archive database.
1074          */
1075          if (@tran_status & 1024 = 1024)
1076          begin
1077              raiserror 19424, "sp_dboption"
1078              return (1)
1079          end
1080  
1081          /*
1082          ** If this database is either marked as needing a database dump, or an
1083          ** unlogged operation was performed in this database, or the database 
1084          ** was truncated then ask the user to first perform a dump database 
1085          ** before turning on this option.
1086          */
1087          if ((@tran_status & 16 = 16) or (@tran_status & 32 = 32) or
1088                  (@tran_status & 64 = 64))
1089          begin
1090              raiserror 17957, @optname, @dbname
1091              return (1)
1092          end
1093  
1094          /*
1095          ** Options 'select into/bulkcopy/pllsort' or 'trunc log on chkpt' are 
1096          ** not valid with "enforce dump tran sequence" option. Therefore, 
1097          ** turn OFF these options.
1098          */
1099          select @selbulk = status & 4
1100          from master.dbo.sysdatabases
1101          where dbid = @dbid
1102  
1103          if ((@tran_status & 8 = 8) or (@selbulk = 4))
1104          begin
1105              update master.dbo.sysdatabases
1106              set status = status & ~ (4 | 8)
1107              where dbid = @dbid
1108              raiserror 17958, @optname, @dbname
1109          end
1110      end
1111  
1112      /* 
1113      ** We do not allow "allow incremental dumps" option if...
1114      */
1115      if ((@statvalue = 536870912) and (@stattype = "D4"))
1116      begin
1117          /*
1118          ** ... the server is SDC.
1119          */
1120  
1121  
1122          /*
1123          ** ... database is a temporary database.
1124          */
1125          if (@isatempdb = 1)
1126          begin
1127              raiserror 17436, @optname
1128              return (1)
1129          end
1130  
1131          /*
1132          ** ... database is an user proxy database or a system proxy database.
1133          */
1134          if (@isproxydb != 0)
1135          begin
1136              raiserror 17190, @optname
1137              return (1)
1138          end
1139      end
1140  
1141      /*
1142      **  Get the current value of the option, for configuration history auditing.
1143      */
1144      if (@stattype = "D")
1145          select @old_value = status & @statvalue
1146          from master.dbo.sysdatabases
1147          where dbid = @dbid
1148      else if (@stattype = "D2")
1149          select @old_value = status2 & @statvalue
1150          from master.dbo.sysdatabases
1151          where dbid = @dbid
1152      else if (@stattype = "D3")
1153          select @old_value = status3 & @statvalue
1154          from master.dbo.sysdatabases
1155          where dbid = @dbid
1156      else
1157          select @old_value = status4 & @statvalue
1158          from master.dbo.sysdatabases
1159          where dbid = @dbid
1160  
1161      /*
1162      **  Now update sysdatabases.
1163      */
1164      if (@on = 1)
1165      begin
1166          /* 
1167          ** If this is the option to set 'abort tran on log full' to 
1168          ** true for sybsecurity database, then don't allow.
1169          */
1170          if (db_name(@dbid) = "sybsecurity"
1171                  and @stattype = "D2" and @statvalue = 1)
1172          begin
1173              /*
1174              ** AUDIT_CHANGE: New error message needs to be reserved and
1175              ** the print statement needs to be removed.
1176              */
1177              print "You cannot set 'abort tran on log full' to true for sybsecurity database."
1178              return (1)
1179          end
1180  
1181          /* 
1182          ** If setting single user and the initializer thread is
1183          ** running, shut it down.
1184          */
1185          if (@statvalue = 4096 and exists (select spid from master..sysprocesses
1186                      where cmd = 'CRDB AUINIT' and dbid = @dbid))
1187          begin
1188              dbcc dbrepair(@dbname, async_database_init, 'kill')
1189              exec sp_getmessage 17899, @msg output
1190              print @msg
1191          end
1192  
1193          /*
1194          ** Disallow DDL IN TRAN 
1195          **	if proxydb option is set (@@crthaproxy = 1)
1196          **	if this server is a HA server (@@cmpstate >= 0)
1197          **	if database is not a tempdb
1198          */
1199          if ((@statvalue = 512) and (@@crthaproxy = 1) and
1200                  (@@cmpstate >= 0) and (@isatempdb = 0))
1201          begin
1202              /*
1203              ** Cannot set DDL_IN_TRAN option for HA servers
1204              ** configured with proxy_db option.
1205              */
1206              exec sp_getmessage 17439, @msg output
1207              print @msg, @success_msg, @dbname
1208              return (1)
1209          end
1210  
1211          if (@stattype = "D")
1212              update master.dbo.sysdatabases
1213              set status = status | @statvalue
1214              where dbid = @dbid
1215          else if (@stattype = "D2")
1216              update master.dbo.sysdatabases
1217              set status2 = status2 | @statvalue
1218              where dbid = @dbid
1219          else if (@stattype = "D3")
1220              update master.dbo.sysdatabases
1221              set status3 = status3 | @statvalue
1222              where dbid = @dbid
1223          else if (@stattype = "D4")
1224              update master.dbo.sysdatabases
1225              set status4 = status4 | @statvalue
1226              where dbid = @dbid
1227          else if (@stattype = "D5")
1228              update master.dbo.sysdatabases
1229              set status5 = status5 | @statvalue
1230              where dbid = @dbid
1231      end
1232  
1233      /*
1234      **  We want to turn it off.
1235      */
1236      else
1237      begin
1238          if (@stattype = "D")
1239              update master.dbo.sysdatabases
1240              set status = status & ~ @statvalue
1241              where dbid = @dbid
1242          else if (@stattype = "D2")
1243              update master.dbo.sysdatabases
1244              set status2 = status2 & ~ @statvalue
1245              where dbid = @dbid
1246          else if (@stattype = "D3")
1247              update master.dbo.sysdatabases
1248              set status3 = status3 & ~ @statvalue
1249              where dbid = @dbid
1250          else if (@stattype = "D4")
1251              update master.dbo.sysdatabases
1252              set status4 = status4 & ~ @statvalue
1253              where dbid = @dbid
1254          else if (@stattype = "D5")
1255              update master.dbo.sysdatabases
1256              set status5 = status5 & ~ @statvalue
1257              where dbid = @dbid
1258      end
1259  
1260  print_and_ckpt:
1261  
1262      exec sp_getmessage @msgno, @msg output
1263      print @msg, @success_msg, @dbname
1264  
1265      /*
1266      ** record the database option change for configuration history auditing
1267      */
1268      select @cha_area = "DATABASE"
1269      select @cha_type = "sp_dboption"
1270      select @cha_target = @dbname
1271      select @cha_element = @success_msg
1272      select @cha_oldvalue = case when @old_value = 0 then "false" else "true" end
1273      select @cha_newvalue = case when @on = 0 then "false" else "true" end
1274      select @cha_mode = NULL
1275      select @cha_instanceid = NULL
1276  
1277      if (@cha_oldvalue != @cha_newvalue)
1278      begin
1279          select @cha_ret = audit_config_history(
1280                  @cha_area,
1281                  @cha_type,
1282                  @cha_target,
1283                  @cha_element,
1284                  @cha_oldvalue,
1285                  @cha_newvalue,
1286                  @cha_mode,
1287                  @cha_instanceid)
1288      end
1289  
1290      if (@dockpt != 0)
1291      begin
1292          exec sp_getmessage 19112, @msg output
1293          print @msg, @dbname, @success_msg
1294  
1295          /*
1296          **  Run the CHECKPOINT command on the database that was changed. If
1297          **  that fails advise the user to run the CHECKPOINT command in the database 
1298          **  that was changed.
1299          */
1300          checkpoint @dbname
1301  
1302          if (@@error != 0)
1303          begin
1304              exec sp_getmessage 19113, @msg output
1305              print @msg, @dbname
1306          end
1307  
1308          /*
1309          ** If the initializer thread is down and there are fragments
1310          ** to initialize, restart it.
1311          */
1312          if (@on = 0 and @statvalue = 4096
1313                  and exists (select 1 from master..sysattributes
1314                      where class = 42 and object = @dbid)
1315                  and not exists (select spid from master..sysprocesses
1316                      where cmd = 'CRDB AUINIT' and dbid = @dbid))
1317          begin
1318              dbcc dbrepair(@dbname, async_database_init, 'start')
1319              exec sp_getmessage 17908, @msg output
1320              print @msg
1321          end
1322  
1323      end
1324      else
1325      begin
1326          exec sp_getmessage 17430, @msg output
1327          print @msg
1328      end
1329  
1330      return (0)
1331  
1332  


exec sp_procxmode 'sp_dboption', 'AnyMode'
go

Grant Execute on sp_dboption to public
go
RESULT SETS
sp_dboption_rset_002
sp_dboption_rset_001

DEFECTS
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MTYP 4 Assignment type mismatch @statopt: smallint = int 208
 MTYP 4 Assignment type mismatch @stat2opt: smallint = int 213
 MTYP 4 Assignment type mismatch @optname: varchar(30) = varchar(36) 470
 MTYP 4 Assignment type mismatch @cha_element: varchar(255) = varchar(1024) 1271
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
210
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
215
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
220
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
225
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
230
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
500
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
541
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
568
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
587
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
601
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
629
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
651
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
667
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
712
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
726
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
750
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
807
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
822
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 167
 QTYP 4 Comparison type mismatch smallint = int 167
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 323
 QTYP 4 Comparison type mismatch smallint = int 323
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 510
 QTYP 4 Comparison type mismatch smallint = int 510
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 517
 QTYP 4 Comparison type mismatch smallint = int 517
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 544
 QTYP 4 Comparison type mismatch smallint = int 544
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 640
 QTYP 4 Comparison type mismatch smallint = int 640
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 662
 QTYP 4 Comparison type mismatch smallint = int 662
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 678
 QTYP 4 Comparison type mismatch smallint = int 678
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 739
 QTYP 4 Comparison type mismatch smallint = int 739
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 833
 QTYP 4 Comparison type mismatch smallint = int 833
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1010
 QTYP 4 Comparison type mismatch smallint = int 1010
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1101
 QTYP 4 Comparison type mismatch smallint = int 1101
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1107
 QTYP 4 Comparison type mismatch smallint = int 1107
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1147
 QTYP 4 Comparison type mismatch smallint = int 1147
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1151
 QTYP 4 Comparison type mismatch smallint = int 1151
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1155
 QTYP 4 Comparison type mismatch smallint = int 1155
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1159
 QTYP 4 Comparison type mismatch smallint = int 1159
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1186
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1214
 QTYP 4 Comparison type mismatch smallint = int 1214
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1218
 QTYP 4 Comparison type mismatch smallint = int 1218
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1222
 QTYP 4 Comparison type mismatch smallint = int 1222
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1226
 QTYP 4 Comparison type mismatch smallint = int 1226
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1230
 QTYP 4 Comparison type mismatch smallint = int 1230
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1241
 QTYP 4 Comparison type mismatch smallint = int 1241
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1245
 QTYP 4 Comparison type mismatch smallint = int 1245
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1249
 QTYP 4 Comparison type mismatch smallint = int 1249
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1253
 QTYP 4 Comparison type mismatch smallint = int 1253
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1257
 QTYP 4 Comparison type mismatch smallint = int 1257
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1314
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 1316
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 TNOI 4 Table with no index master..sysengines master..sysengines
 TNOI 4 Table with no index master..sysprocesses master..sysprocesses
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MDYN 3 Proc uses Dynamic SQL but is not flagged with Dynamic Ownership Chain 74
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysattributes  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public master..syscurconfigs  
 MGTP 3 Grant to public master..sysdatabases  
 MGTP 3 Grant to public master..sysengines  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public master..sysprocesses  
 MGTP 3 Grant to public sybsystemprocs..sp_dboption  
 MNER 3 No Error Check should check return value of exec 249
 MNER 3 No Error Check should check return value of exec 440
 MNER 3 No Error Check should check return value of exec 441
 MNER 3 No Error Check should check return value of exec 485
 MNER 3 No Error Check should check return value of exec 534
 MNER 3 No Error Check should check return value of exec 557
 MNER 3 No Error Check should check return value of exec 697
 MNER 3 No Error Check should check @@error after update 1105
 MNER 3 No Error Check should check return value of exec 1189
 MNER 3 No Error Check should check return value of exec 1206
 MNER 3 No Error Check should check @@error after update 1212
 MNER 3 No Error Check should check @@error after update 1216
 MNER 3 No Error Check should check @@error after update 1220
 MNER 3 No Error Check should check @@error after update 1224
 MNER 3 No Error Check should check @@error after update 1228
 MNER 3 No Error Check should check @@error after update 1239
 MNER 3 No Error Check should check @@error after update 1243
 MNER 3 No Error Check should check @@error after update 1247
 MNER 3 No Error Check should check @@error after update 1251
 MNER 3 No Error Check should check @@error after update 1255
 MNER 3 No Error Check should check return value of exec 1262
 MNER 3 No Error Check should check return value of exec 1292
 MNER 3 No Error Check should check return value of exec 1304
 MNER 3 No Error Check should check return value of exec 1319
 MNER 3 No Error Check should check return value of exec 1326
 MUCO 3 Useless Code Useless Brackets 255
 MUCO 3 Useless Code Useless Brackets 359
 MUCO 3 Useless Code Useless Brackets 380
 MUCO 3 Useless Code Useless Brackets 395
 MUCO 3 Useless Code Useless Brackets 397
 MUCO 3 Useless Code Useless Brackets 400
 MUCO 3 Useless Code Useless Brackets 402
 MUCO 3 Useless Code Useless Brackets 416
 MUCO 3 Useless Code Useless Brackets 417
 MUCO 3 Useless Code Useless Brackets 426
 MUCO 3 Useless Code Useless Brackets 437
 MUCO 3 Useless Code Useless Brackets 447
 MUCO 3 Useless Code Useless Brackets 459
 MUCO 3 Useless Code Useless Brackets 474
 MUCO 3 Useless Code Useless Brackets 476
 MUCO 3 Useless Code Useless Brackets 478
 MUCO 3 Useless Code Useless Brackets 483
 MUCO 3 Useless Code Useless Brackets 502
 MUCO 3 Useless Code Useless Brackets 532
 MUCO 3 Useless Code Useless Brackets 537
 MUCO 3 Useless Code Useless Brackets 618
 MUCO 3 Useless Code Useless Brackets 685
 MUCO 3 Useless Code Useless Brackets 699
 MUCO 3 Useless Code Useless Brackets 741
 MUCO 3 Useless Code Useless Brackets 765
 MUCO 3 Useless Code Useless Brackets 774
 MUCO 3 Useless Code Useless Brackets 782
 MUCO 3 Useless Code Useless Brackets 792
 MUCO 3 Useless Code Useless Brackets 848
 MUCO 3 Useless Code Useless Brackets 855
 MUCO 3 Useless Code Useless Brackets 871
 MUCO 3 Useless Code Useless Brackets 875
 MUCO 3 Useless Code Useless Brackets 882
 MUCO 3 Useless Code Useless Brackets 889
 MUCO 3 Useless Code Useless Brackets 896
 MUCO 3 Useless Code Useless Brackets 919
 MUCO 3 Useless Code Useless Brackets 927
 MUCO 3 Useless Code Useless Brackets 935
 MUCO 3 Useless Code Useless Brackets 943
 MUCO 3 Useless Code Useless Brackets 952
 MUCO 3 Useless Code Useless Brackets 960
 MUCO 3 Useless Code Useless Brackets 963
 MUCO 3 Useless Code Useless Brackets 967
 MUCO 3 Useless Code Useless Brackets 970
 MUCO 3 Useless Code Useless Brackets 973
 MUCO 3 Useless Code Useless Brackets 980
 MUCO 3 Useless Code Useless Brackets 987
 MUCO 3 Useless Code Useless Brackets 995
 MUCO 3 Useless Code Useless Brackets 1004
 MUCO 3 Useless Code Useless Brackets 1012
 MUCO 3 Useless Code Useless Brackets 1015
 MUCO 3 Useless Code Useless Brackets 1027
 MUCO 3 Useless Code Useless Brackets 1030
 MUCO 3 Useless Code Useless Brackets 1038
 MUCO 3 Useless Code Useless Brackets 1041
 MUCO 3 Useless Code Useless Brackets 1047
 MUCO 3 Useless Code Useless Brackets 1051
 MUCO 3 Useless Code Useless Brackets 1057
 MUCO 3 Useless Code Useless Brackets 1060
 MUCO 3 Useless Code Useless Brackets 1066
 MUCO 3 Useless Code Useless Brackets 1069
 MUCO 3 Useless Code Useless Brackets 1075
 MUCO 3 Useless Code Useless Brackets 1078
 MUCO 3 Useless Code Useless Brackets 1087
 MUCO 3 Useless Code Useless Brackets 1091
 MUCO 3 Useless Code Useless Brackets 1103
 MUCO 3 Useless Code Useless Brackets 1115
 MUCO 3 Useless Code Useless Brackets 1125
 MUCO 3 Useless Code Useless Brackets 1128
 MUCO 3 Useless Code Useless Brackets 1134
 MUCO 3 Useless Code Useless Brackets 1137
 MUCO 3 Useless Code Useless Brackets 1144
 MUCO 3 Useless Code Useless Brackets 1148
 MUCO 3 Useless Code Useless Brackets 1152
 MUCO 3 Useless Code Useless Brackets 1164
 MUCO 3 Useless Code Useless Brackets 1170
 MUCO 3 Useless Code Useless Brackets 1178
 MUCO 3 Useless Code Useless Brackets 1185
 MUCO 3 Useless Code Useless Brackets 1199
 MUCO 3 Useless Code Useless Brackets 1208
 MUCO 3 Useless Code Useless Brackets 1211
 MUCO 3 Useless Code Useless Brackets 1215
 MUCO 3 Useless Code Useless Brackets 1219
 MUCO 3 Useless Code Useless Brackets 1223
 MUCO 3 Useless Code Useless Brackets 1227
 MUCO 3 Useless Code Useless Brackets 1238
 MUCO 3 Useless Code Useless Brackets 1242
 MUCO 3 Useless Code Useless Brackets 1246
 MUCO 3 Useless Code Useless Brackets 1250
 MUCO 3 Useless Code Useless Brackets 1254
 MUCO 3 Useless Code Useless Brackets 1277
 MUCO 3 Useless Code Useless Brackets 1290
 MUCO 3 Useless Code Useless Brackets 1302
 MUCO 3 Useless Code Useless Brackets 1312
 MUCO 3 Useless Code Useless Brackets 1330
 MUOT 3 Updates outside transaction 1255
 QAFM 3 Var Assignment from potentially many rows 208
 QAFM 3 Var Assignment from potentially many rows 213
 QAFM 3 Var Assignment from potentially many rows 218
 QAFM 3 Var Assignment from potentially many rows 223
 QAFM 3 Var Assignment from potentially many rows 228
 QAFM 3 Var Assignment from potentially many rows 498
 QAFM 3 Var Assignment from potentially many rows 539
 QAFM 3 Var Assignment from potentially many rows 585
 QAFM 3 Var Assignment from potentially many rows 648
 QAFM 3 Var Assignment from potentially many rows 748
 QAFM 3 Var Assignment from potentially many rows 805
 QAFM 3 Var Assignment from potentially many rows 819
 QAFM 3 Var Assignment from potentially many rows 910
 QAFM 3 Var Assignment from potentially many rows 913
 QCRS 3 Conditional Result Set 710
 QCRS 3 Conditional Result Set 724
 QISO 3 Set isolation level 362
 QISO 3 Set isolation level 799
 QNAJ 3 Not using ANSI Inner Join 306
 QNAJ 3 Not using ANSI Inner Join 627
 QNAJ 3 Not using ANSI Inner Join 649
 QNAJ 3 Not using ANSI Inner Join 665
 QNAJ 3 Not using ANSI Inner Join 725
 QNAJ 3 Not using ANSI Inner Join 820
 QNAJ 3 Not using ANSI Inner Join 914
 QNAM 3 Select expression has no name convert(char(22), description) 724
 QNUA 3 Should use Alias: Column description should use alias sysmessages 305
 QNUA 3 Should use Alias: Table master..spt_values 306
 QNUA 3 Should use Alias: Table master..sysmessages 306
 QNUA 3 Should use Alias: Column type should use alias spt_values 307
 QNUA 3 Should use Alias: Column number should use alias spt_values 308
 QNUA 3 Should use Alias: Column number should use alias spt_values 309
 QNUA 3 Should use Alias: Column type should use alias spt_values 310
 QNUA 3 Should use Alias: Column number should use alias spt_values 311
 QNUA 3 Should use Alias: Column number should use alias spt_values 312
 QNUA 3 Should use Alias: Column type should use alias spt_values 313
 QNUA 3 Should use Alias: Column number should use alias spt_values 314
 QNUA 3 Should use Alias: Column name should use alias spt_values 315
 QNUA 3 Should use Alias: Column type should use alias spt_values 316
 QNUA 3 Should use Alias: Column number should use alias spt_values 317
 QNUA 3 Should use Alias: Column name should use alias spt_values 318
 QNUA 3 Should use Alias: Column type should use alias spt_values 319
 QNUA 3 Should use Alias: Column number should use alias spt_values 320
 QNUA 3 Should use Alias: Column name should use alias spt_values 321
 QNUA 3 Should use Alias: Column error should use alias sysmessages 322
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 322
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 323
 QNUA 3 Should use Alias: Table master..spt_values 627
 QNUA 3 Should use Alias: Table master..sysmessages 627
 QNUA 3 Should use Alias: Column description should use alias sysmessages 628
 QNUA 3 Should use Alias: Column type should use alias spt_values 629
 QNUA 3 Should use Alias: Column number should use alias spt_values 630
 QNUA 3 Should use Alias: Column type should use alias spt_values 631
 QNUA 3 Should use Alias: Column number should use alias spt_values 632
 QNUA 3 Should use Alias: Column type should use alias spt_values 633
 QNUA 3 Should use Alias: Column number should use alias spt_values 634
 QNUA 3 Should use Alias: Column type should use alias spt_values 635
 QNUA 3 Should use Alias: Column number should use alias spt_values 636
 QNUA 3 Should use Alias: Column type should use alias spt_values 637
 QNUA 3 Should use Alias: Column number should use alias spt_values 638
 QNUA 3 Should use Alias: Column error should use alias sysmessages 639
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 639
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 640
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 648
 QNUA 3 Should use Alias: Table master..spt_values 649
 QNUA 3 Should use Alias: Table master..sysmessages 649
 QNUA 3 Should use Alias: Column description should use alias sysmessages 650
 QNUA 3 Should use Alias: Column type should use alias spt_values 651
 QNUA 3 Should use Alias: Column number should use alias spt_values 652
 QNUA 3 Should use Alias: Column type should use alias spt_values 653
 QNUA 3 Should use Alias: Column number should use alias spt_values 654
 QNUA 3 Should use Alias: Column type should use alias spt_values 655
 QNUA 3 Should use Alias: Column number should use alias spt_values 656
 QNUA 3 Should use Alias: Column type should use alias spt_values 657
 QNUA 3 Should use Alias: Column number should use alias spt_values 658
 QNUA 3 Should use Alias: Column type should use alias spt_values 659
 QNUA 3 Should use Alias: Column number should use alias spt_values 660
 QNUA 3 Should use Alias: Column error should use alias sysmessages 661
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 661
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 662
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 664
 QNUA 3 Should use Alias: Table master..spt_values 665
 QNUA 3 Should use Alias: Table master..sysmessages 665
 QNUA 3 Should use Alias: Column description should use alias sysmessages 666
 QNUA 3 Should use Alias: Column type should use alias spt_values 667
 QNUA 3 Should use Alias: Column number should use alias spt_values 668
 QNUA 3 Should use Alias: Column type should use alias spt_values 669
 QNUA 3 Should use Alias: Column number should use alias spt_values 670
 QNUA 3 Should use Alias: Column type should use alias spt_values 671
 QNUA 3 Should use Alias: Column number should use alias spt_values 672
 QNUA 3 Should use Alias: Column type should use alias spt_values 673
 QNUA 3 Should use Alias: Column number should use alias spt_values 674
 QNUA 3 Should use Alias: Column type should use alias spt_values 675
 QNUA 3 Should use Alias: Column number should use alias spt_values 676
 QNUA 3 Should use Alias: Column error should use alias sysmessages 677
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 677
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 678
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 679
 QNUA 3 Should use Alias: Column description should use alias sysmessages 724
 QNUA 3 Should use Alias: Column name should use alias spt_values 724
 QNUA 3 Should use Alias: Table master..spt_values 725
 QNUA 3 Should use Alias: Table master..sysmessages 725
 QNUA 3 Should use Alias: Column name should use alias spt_values 726
 QNUA 3 Should use Alias: Column description should use alias sysmessages 727
 QNUA 3 Should use Alias: Column type should use alias spt_values 728
 QNUA 3 Should use Alias: Column number should use alias spt_values 729
 QNUA 3 Should use Alias: Column type should use alias spt_values 730
 QNUA 3 Should use Alias: Column number should use alias spt_values 731
 QNUA 3 Should use Alias: Column type should use alias spt_values 732
 QNUA 3 Should use Alias: Column number should use alias spt_values 733
 QNUA 3 Should use Alias: Column type should use alias spt_values 734
 QNUA 3 Should use Alias: Column number should use alias spt_values 735
 QNUA 3 Should use Alias: Column type should use alias spt_values 736
 QNUA 3 Should use Alias: Column number should use alias spt_values 737
 QNUA 3 Should use Alias: Column error should use alias sysmessages 738
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 738
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 739
 QNUA 3 Should use Alias: Column name should use alias spt_values 819
 QNUA 3 Should use Alias: Column number should use alias spt_values 819
 QNUA 3 Should use Alias: Column type should use alias spt_values 819
 QNUA 3 Should use Alias: Table master..spt_values 820
 QNUA 3 Should use Alias: Table master..sysmessages 820
 QNUA 3 Should use Alias: Column description should use alias sysmessages 821
 QNUA 3 Should use Alias: Column type should use alias spt_values 822
 QNUA 3 Should use Alias: Column number should use alias spt_values 823
 QNUA 3 Should use Alias: Column type should use alias spt_values 824
 QNUA 3 Should use Alias: Column number should use alias spt_values 825
 QNUA 3 Should use Alias: Column type should use alias spt_values 826
 QNUA 3 Should use Alias: Column number should use alias spt_values 827
 QNUA 3 Should use Alias: Column type should use alias spt_values 828
 QNUA 3 Should use Alias: Column number should use alias spt_values 829
 QNUA 3 Should use Alias: Column type should use alias spt_values 830
 QNUA 3 Should use Alias: Column number should use alias spt_values 831
 QNUA 3 Should use Alias: Column error should use alias sysmessages 832
 QNUA 3 Should use Alias: Column msgnum should use alias spt_values 832
 QNUA 3 Should use Alias: Column langid should use alias sysmessages 833
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
165
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
322
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
639
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
661
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
677
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
738
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
832
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {name}
911
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered
(name, parent, config)
Intersection: {name}
916
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered
(class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo)
Intersection: {class, object}
1314
 QSWV 3 Sarg with variable @statopt, Candidate Index: spt_values.spt_valuesclust clustered(number, type) S 257
 QSWV 3 Sarg with variable @stat2opt, Candidate Index: spt_values.spt_valuesclust clustered(number, type) S 260
 QSWV 3 Sarg with variable @statopt, Candidate Index: spt_values.spt_valuesclust clustered(number, type) S 309
 QSWV 3 Sarg with variable @stat2opt, Candidate Index: spt_values.spt_valuesclust clustered(number, type) S 312
 QSWV 3 Sarg with variable @optmsgnum, Candidate Index: spt_values.spt_valuesclust clustered(number, type) U 612
 QSWV 3 Sarg with variable @optmsgnum, Candidate Index: spt_values.spt_valuesclust clustered(number, type) U 679
 VNRD 3 Variable is not read @flstr 160
 VNRD 3 Variable is not read @nullarg 391
 VNRD 3 Variable is not read @dummy 413
 VNRD 3 Variable is not read @cha_ret 1279
 VUNU 3 Variable is not used @DMPX_NOTOK_NONLOGGED_WRITES 112
 VUNU 3 Variable is not used @DMPX_NOTOK_TRUNCATED_ONLY 113
 MDYS 2 Dynamic SQL Marker 300
 MDYS 2 Dynamic SQL Marker 356
 MRST 2 Result Set Marker 710
 MRST 2 Result Set Marker 724
 MSUB 2 Subquery Marker 164
 MSUB 2 Subquery Marker 509
 MSUB 2 Subquery Marker 516
 MSUB 2 Subquery Marker 543
 MSUB 2 Subquery Marker 1185
 MSUB 2 Subquery Marker 1313
 MSUB 2 Subquery Marker 1315
 MTR1 2 Metrics: Comments Ratio Comments: 38% 74
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 247 = 282dec - 37exi + 2 74
 MTR3 2 Metrics: Query Complexity Complexity: 692 74
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 305
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 626
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 648
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 664
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 724
 PRED_QUERY_COLLECTION 2 {m=master..sysmessages, sv=master..spt_values} 0 819
 PRED_QUERY_COLLECTION 2 {c=master..syscurconfigs, c2=master..sysconfigures} 0 913

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysengines (1)  
reads table master..syscurconfigs (1)  
reads table master..sysprocesses (1)  
reads table master..spt_values (1)  
writes table sybsystemprocs..sp_dboption_rset_002 
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..sysconfigures (1)  
   reads table master..syscurconfigs (1)  
reads table master..sysconfigures (1)  
reads table master..sysattributes (1)  
calls proc sybsystemprocs..sp_dboption_flmode  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
   calls proc sybsystemprocs..sp_ha_check_certified  
      reads table tempdb..sysobjects (1)  
   reads table master..sysdatabases (1)  
   read_writes table master..sysattributes (1)  
   writes table tempdb..#tmp (1) 
   calls proc sybsystemprocs..sp_autoformat  
      reads table tempdb..systypes (1)  
      writes table sybsystemprocs..sp_autoformat_rset_001 
      writes table sybsystemprocs..sp_autoformat_rset_005 
      writes table sybsystemprocs..sp_autoformat_rset_003 
      read_writes table tempdb..#colinfo_af (1) 
      calls proc sybsystemprocs..sp_autoformat  
      writes table sybsystemprocs..sp_autoformat_rset_004 
      calls proc sybsystemprocs..sp_namecrack  
      writes table sybsystemprocs..sp_autoformat_rset_002 
      reads table master..systypes (1)  
      reads table master..syscolumns (1)  
      reads table tempdb..syscolumns (1)  
   calls proc sybsystemprocs..sp_getmessage  
      reads table master..sysmessages (1)  
      reads table sybsystemprocs..sysusermessages  
      reads table master..syslanguages (1)  
      calls proc sybsystemprocs..sp_validlang  
         reads table master..syslanguages (1)  
reads table master..sysmessages (1)  
calls proc sybsystemprocs..sp_getmessage  
writes table sybsystemprocs..sp_dboption_rset_001 
read_writes table master..sysdatabases (1)