DatabaseProcApplicationCreatedLinks
sybsystemprocssp_addserver  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/addserver */
4     
5     /*
6     ** Messages for "sp_addserver"          17290
7     **
8     ** 17260, "Can't run %1! from within a transaction." 
9     ** 17240, "'" + @lname + "' is not a valid name." 
10    ** 17290, "There is already a server named '%1!', physical name '%2!'."
11    ** 17291, "Usage: sp_addserver servername [, 'local | NULL'] [, physical_name]"
12    ** 17292, "There is already a local server."
13    ** 17293, "Server added."
14    ** 17294, "Changing physical name of server '%1!' from '%2!' to '%3!'"
15    ** 17295, "Adding server '%1!', physical name '%2!'"
16    ** 17296, "Unknown server class '%1!'."
17    ** 17297, "Changing server class of server '%1!' from '%2!' to '%3!'"
18    ** 17869, "Stored procedure %1 failed because %2 failed in database %3."
19    ** 18388, "You must be in the master database in order to run '%1'!."
20    ** 18409, "The built-in function getdbrepstat() failed."
21    ** 18773, "HA_LOG: HA consistency check failure in '%1!' on the companion server '%2!'"
22    ** 18784, "HA warning:Server is currently configured. Any changes to SYB_HACMP or companion server can be serious."
23    ** 18799, "Unable to find a server with name '%1!', id '%2!', and netname '%3!' in sysservers."
24    ** 18800, "A server with name '%1!' and id '%2!' already exists in sysservers."
25    ** 18820, "You cannot change the physical name of server %1! because it is configured as a node of HA cluster."
26    ** 18881, "Unable to generate %1! for HA use. Please Refer to documentation for details."
27    ** 18887, "Cannot have more than one physical or logical server entry for the 
28    ** ASEJB class."
29    ** 19971, "You cannot change the server class of existing server '%1!' from '%2!' to '%3!'."
30    ** 19972, "Local server must use the cluster name as the server name."
31    */
32    
33    /* 
34    ** IMPORTANT: Please read the following instructions before
35    **   making changes to this stored procedure.
36    **
37    **	To make this stored procedure compatible with High Availability (HA),
38    **	changes to certain system tables must be propagated 
39    **	to the companion server under some conditions.
40    **	The tables include (but are not limited to):
41    **		syslogins, sysservers, sysattributes, systimeranges,
42    **		sysresourcelimits, sysalternates, sysdatabases,
43    **		syslanguages, sysremotelogins, sysloginroles,
44    **		sysalternates (master DB only), systypes (master DB only),
45    **		sysusers (master DB only), sysprotects (master DB only)
46    **	please refer to the HA documentation for detail.
47    **
48    **	Here is what you need to do: 
49    **	For each insert/update/delete statement, add three sections to
50    **	-- start HA transaction prior to the statement
51    **	-- add the statement
52    **	-- add HA synchronization code to propagate the change to the companion
53    **
54    **	For example, if you are adding 
55    **		insert master.dbo.syslogins ......
56    **	the code should look like:
57    **	1. Now, the SQL statement:
58    **		insert master.dbo.syslogins ......
59    **	2. Add a HA synchronization section right after the SQL statement:
60    **		
61    **
62    **	You may need to do similar change for each built-in function you
63    **	want to add.
64    */
65    
66    create or replace procedure sp_addserver
67        @lname varchar(255), /* server logical name */
68        @class varchar(15) = "ASEnterprise", /* server class */
69        @pname varchar(255) = NULL /* server physical name */
70    as
71        declare @msg varchar(1024),
72            @netname varchar(255),
73            @dflt_status smallint,
74            @dflt_status2 unsigned int
75    
76        declare @srvclass smallint,
77            @newclass smallint,
78            @srvid smallint,
79            @remotesrvid smallint,
80            @srvcost smallint,
81            @oldclass varchar(255),
82            @dupsrvclass smallint,
83            @outstr varchar(255), /* for SDC dbcc set_scope */
84            @scope varchar(16) /* for SDC dbcc set_scope */
85    
86        declare @maxlen int
87        declare @end_code int
88        declare @HA_CERTIFIED tinyint /* Is the SP HA certified ? */
89        declare @retstat int
90        declare @retstat1 int
91        declare @backupejbflag int
92        declare @isrtds int /* server class is rtds */
93        declare @insysattributes int /* There is row about the changed rtds server in sysattributes */
94        declare @leavertds int /* server class is changed from rtds to non-rtds */
95    
96        declare @bs_name varchar(255) /* BS name to be checked in sysservers table */
97        declare @bs_flag int /* Indicate BS entries in sysservers table */
98        declare @dbname varchar(255) /* for disp dbname in logexec error message */
99        declare @nullarg char(1) /* for passing null as an argument */
100       declare @master_is_rep int /* whether master db is replicated */
101       declare @dummy int
102       declare @gp_enabled int
103   
104   
105       select @HA_CERTIFIED = 0
106       select @backupejbflag = 0
107       select @isrtds = 0
108       select @insysattributes = 0
109       select @leavertds = 0
110   
111   
112   
113   
114       /* check to see if we are using HA specific SP for a HA enabled server */
115       exec @retstat = sp_ha_check_certified 'sp_addserver', @HA_CERTIFIED
116       if (@retstat != 0)
117           return (1)
118   
119       /*
120       ** If we are logging this system procedure for replication,
121       ** we must be in the 'master' database to avoid creating a
122       ** multi-database transaction which could make recovery of
123       ** the 'master' database impossible.
124       */
125       select @master_is_rep = getdbrepstat(1)
126   
127       if (@master_is_rep < 0)
128       begin
129           /*
130           ** 18409, "The built-in function getdbrepstat() failed."
131           */
132           raiserror 18409, "getdbrepstat"
133           return (1)
134       end
135   
136       select @dbname = db_name()
137   
138       if (@master_is_rep > 0) and (@dbname != "master")
139       begin
140           /*
141           ** 18388, "You must be in the master database in order
142           ** to run '%1!'."
143           */
144           raiserror 18388, "sp_addserver"
145           return (1)
146       end
147   
148       /*
149       **  If we're in a transaction, disallow this since it might make recovery
150       **  impossible.
151       */
152       if @@trancount > 0
153       begin
154           /*
155           ** 17260, "Can't run %1! from within a transaction." 
156           */
157           raiserror 17260, "sp_addserver"
158           return (1)
159       end
160       else
161       begin
162           set chained off
163       end
164       set transaction isolation level 1
165   
166       /* 
167       ** If granular permissions is not enabled, the user must have sso_role.
168       ** If granular permissions is enabled then the user must have 'manage
169       ** server' permission and if the cluster mode is "shared disk 
170       ** cluster" then the user must also have 'manage cluster' permission.
171       ** proc_role() and proc_auditperm() will do auditing.
172       */
173   
174       select @retstat = 0
175       select @retstat1 = 0
176       select @nullarg = NULL
177       execute @retstat = sp_aux_checkroleperm "sso_role",
178           "manage server", @nullarg, @gp_enabled output
179   
180       if ((@gp_enabled = 0) and (proc_role("sso_role") = 0))
181           return (1)
182       if (@gp_enabled = 1)
183       begin
184           /* Audit */
185           select @dummy = proc_auditperm("manage server", @retstat)
186           if (@@clustermode = "shared disk cluster")
187           begin
188               execute @retstat1 = sp_aux_checkroleperm
189                   @nullarg, "manage cluster", @nullarg, @gp_enabled output
190   
191               /* Audit */
192               select @dummy = proc_auditperm("manage cluster", @retstat1)
193           end
194           if ((@retstat != 0) or (@retstat1 != 0))
195               return 1
196   
197       end
198   
199       /*
200       **  Check to see that the @lname is valid.
201       */
202       if (@lname is not null)
203       begin
204           select @maxlen = length from master.dbo.syscolumns
205           where id = object_id("master.dbo.sysservers") and name = "srvname"
206   
207           if valid_name(@lname, @maxlen) = 0
208           begin
209               /*
210               ** 17240, "'" + @lname + "' is not a valid name." 
211               */
212               raiserror 17240, @lname
213               return (1)
214           end
215       end
216   
217       /*
218       **  Check to see that the @lname is valid name.
219       */
220       if (@lname is not null)
221       begin
222           if (@lname = "cluster" or @lname = "CLUSTER")
223           begin
224               /*
225               ** 17240, "'" + @lname + "' is not a valid name." 
226               */
227               raiserror 17240, @lname
228               return (1)
229           end
230       end
231   
232       /*
233       ** OMNI: See if we have a valid server class. If null, default to 'sql_server'.
234       */
235       if @class is null
236           select @class = "ASEnterprise"
237   
238       select @newclass = number
239       from master.dbo.spt_values
240       where type = 'X' and lower(name) = lower(@class)
241       if @@rowcount = 0
242       begin
243           /*
244           ** 17296, "Unknown server class '%1!'" 
245           */
246           raiserror 17296, @class
247           return (1)
248       end
249   
250       /*
251       ** to check if the server is a rtds provider
252       */
253       if @newclass in (12, 13, 14, 15)
254           select @isrtds = 1
255       else
256           select @isrtds = 0
257   
258       /*
259       **  Check to see that the @pname is valid.
260       */
261       if (@pname is NULL)
262           select @pname = @lname
263       else
264           /*
265           ** If the netname contains a colon, it's ok to use, as it may be in the form:
266           **
267           ** 	"hostname.domain.com:12345"	or
268           **	"hostname:12345"		or
269           **	"255.255.255.255:12345"
270           **
271           ** which is format for netname now supported by ctlib's CS_SERVERADDR connection 
272           ** property. Note that Omni converts colon to space before calling ct_con_props().
273           **
274           ** Note, IBM_MQ names (class == 13) don't have colons (:), but they have
275           ** parenthesis (()), so bypass the valid name check.
276           */
277   
278           select @maxlen = length from master.dbo.syscolumns
279           where id = object_id("master.dbo.sysservers") and name = "srvnetname"
280   
281       /*
282       ** If the name is SYB_BACKUP and netname is $dedicated or $roundrobin which is
283       ** Backup server policy to enable Multiple Backup server feature,
284       ** check for all Backup server entries in sysservers table.
285       */
286       if ((@lname = "SYB_BACKUP") and ((lower(@pname) = "$dedicated") or (lower(@pname) = "$roundrobin")))
287       begin
288           select @bs_flag = 0
289   
290           declare instancenames cursor for
291           select srvname from master..sysservers where srvstatus2 = 4
292   
293           open instancenames
294   
295           fetch instancenames into @bs_name
296   
297           while (@@sqlstatus = 0)
298           begin
299               select @bs_name = @bs_name + "_BS"
300               if not exists (select * from master..sysservers where srvname = @bs_name)
301               begin
302                   /*
303                   ** 19968, "Backup Server '%1!' is not configured in sysservers."
304                   */
305                   raiserror 19968, @bs_name
306                   select @bs_flag = 1
307               end
308               fetch instancenames into @bs_name
309           end
310           close instancenames
311   
312           if (@bs_flag = 1)
313           begin
314               /*
315               ** 19969, "Multiple Backup Server in Cluster can not be enabled."
316               */
317               raiserror 19969
318               return (1)
319           end
320       end
321   
322       /*
323       ** If the name is SYB_BACKUP and netname is $dedicated or $roundrobin which is
324       ** Backup server policy to enable Multiple Backup server feature,
325       ** allow the netname as specified keywords skipping valid_name() check.
326       */
327       if (not ((@lname = "SYB_BACKUP") and ((lower(@pname) = "$dedicated") or (lower(@pname) = "$roundrobin"))))
328       begin
329           if charindex(":", @pname) = 0 and valid_name(@pname, @maxlen) = 0 and @newclass != 13
330           begin
331               /*
332               ** 17240, "'" + @pname + "' is not a valid name." 
333               */
334               raiserror 17240, @pname
335               return (1)
336           end
337       end
338   
339       /*
340       ** If the server is rtds provider, check if it is registered in sysattributes
341       */
342       if (@isrtds = 1)
343           and (exists (select * from master.dbo.sysattributes
344                   where class = 21 and attribute = 10
345                       and object_type = 'PR'
346                       and object_cinfo = @lname))
347           select @insysattributes = 1
348       else
349           select @insysattributes = 0
350   
351       /*
352       **  Server names must be unique so check.  If a server already exists with
353       **  this logical _and_ physical name, the server already exists, so there's
354       **  no work to do.  However, if the logical name exists but the physical
355       **  names differ, this will be an update to the table to change the physical
356       **  name.
357       */
358       if exists (select *
359               from master.dbo.sysservers
360               where srvname = @lname)
361       begin
362           if (@isrtds = 0) or (@insysattributes = 0)
363           begin
364               select @srvclass = srvclass,
365                   @srvid = srvid,
366                   @netname = isnull(srvnetname, @lname)
367               from master.dbo.sysservers
368               where srvname = @lname
369           end
370           else
371           begin
372               select @srvclass = int_value,
373                   @srvid = object,
374                   @netname = isnull(char_value, @lname)
375               from master.dbo.sysattributes
376               where class = 21 and attribute = 10
377                   and object_type = 'PR'
378                   and object_cinfo = @lname
379           end
380   
381           /*
382           ** 17290, "There is already a server named '%1!', physical name '%2!'."
383           */
384           if (@netname = @pname AND @srvclass = @newclass)
385           begin
386               raiserror 17290, @lname, @pname
387               return (1)
388           end
389   
390           if (@isrtds = 0) and (@srvclass in (12, 13, 14, 15))
391               select @leavertds = 1
392           else
393               select @leavertds = 0
394   
395           /* 
396           ** This transaction also writes a log record for replicating the
397           ** invocation of this procedure. If logexec() fails, the transaction
398           ** is aborted.
399           **
400           ** IMPORTANT: The name rs_logexec is significant and is used by
401           ** Adaptive Server.
402           */
403           begin tran rs_logexec
404   
405   
406   
407           if (@isrtds = 1) or (@leavertds = 1)
408               begin tran rtds_dyn
409   
410           if (@leavertds = 1)
411           begin
412               delete from master.dbo.sysattributes
413               where class = 21 and attribute = 10
414                   and object_type = 'PR' and object_cinfo = @lname
415               if (@@error != 0)
416                   goto clean_all
417           end
418   
419           if (@isrtds = 1)
420           begin
421               if (@insysattributes = 1)
422                   update master.dbo.sysattributes
423                   set char_value = @pname, int_value = @newclass
424                   where class = 21 and attribute = 10
425                       and object_type = 'PR'
426                       and object_cinfo = @lname
427               else
428                   insert master.dbo.sysattributes
429                   (class, attribute, object_type, object_cinfo,
430                       object, int_value, char_value)
431                   values (21, 10, 'PR', @lname, @srvid, @newclass,
432                       @pname)
433               if (@@error != 0)
434                   goto clean_all
435           end
436   
437   
438   
439           /*
440           ** 17294, "Changing physical name of server '%1!' from '%2!' to '%3!'"
441           */
442           if (@netname != @pname)
443           begin
444               update master.dbo.sysservers
445               set srvnetname = @pname
446               where srvname = @lname
447   
448               if (@@error != 0)
449               begin
450                   goto clean_all
451               end
452   
453   
454   
455               /* Suppress the Msg only for SYB_HACMP changes for netname */
456               if @lname != "SYB_HACMP"
457               begin
458                   exec sp_getmessage 17294, @msg output
459                   print @msg, @lname, @netname, @pname
460               end
461           end
462   
463           /*
464           ** 17297, Changing server class of server '%1!' from '%2!' to '%3!'
465           */
466           if (@srvclass != @newclass)
467           begin
468               select @oldclass = name
469               from master.dbo.spt_values
470               where type = 'X' and number = @srvclass
471               if @@rowcount = 0
472               begin
473                   select @oldclass = "unknown"
474               end
475   
476               if lower(@class) = "local"
477               begin
478                   /*
479                   ** 19971, "You cannot change the server class of
480                   ** existing server '%1!' from '%2!' to '%3!'."
481                   */
482                   raiserror 19971, @lname, @oldclass, @class
483                   goto clean_all
484               end
485   
486               update master.dbo.sysservers
487               set srvclass = @newclass
488               where srvname = @lname
489   
490               if (@@error != 0)
491               begin
492                   goto clean_all
493               end
494   
495   
496               exec sp_getmessage 17297, @msg output
497               print @msg, @lname, @oldclass, @class
498           end
499   
500           if (@isrtds = 1) or (@leavertds = 1)
501               commit tran rtds_dyn
502           /*
503           ** For SDC, update cluster-wide in-memory SRVDES with data from
504           ** just-updated SYSSERVERS table. Before dbcc cis, the dbcc
505           ** command scope needs to be set to cluster.
506           */
507           if (@@clustermode = "shared disk cluster")
508           begin
509               select @scope = NULL
510               select @outstr = "dbcc set_scope_in_cluster('scope')"
511               if (charindex("instance", @outstr) != 0)
512               begin
513                   /* save the scope to be restored later */
514                   select @scope = "instance"
515                   dbcc set_scope_in_cluster('cluster')
516               end
517           end
518   
519           dbcc cis("srvdes", @srvid)
520   
521           /* restore dbcc command scope */
522           if (@@clustermode = "shared disk cluster")
523           begin
524               if (@scope = "instance")
525               begin
526                   dbcc set_scope_in_cluster('instance')
527               end
528           end
529   
530   
531   
532           goto commit_all
533       end
534   
535       /*
536       ** Check to see that the server class is unique for the EJB class
537       */
538       select @dupsrvclass = srvclass
539       from master.dbo.sysservers
540       where srvclass = 10 and @class = "ASEJB"
541   
542       if @@rowcount >= 1
543       begin
544           /*
545           ** 18887, "Cannot have more than one physical or logical server 
546           ** entry for the ASEJB class."
547           */
548           raiserror 18887
549           goto clean_all
550       end
551   
552       /* 
553       ** If the server is of the class ASEJB, set the default status to 1024 which
554       ** indicates that the 'external engine auto start option would be enabled
555       ** for such class of servers
556       */
557       if @class = "ASEJB"
558       begin
559           select @dflt_status = number from master.dbo.spt_values
560           where type = "A" and name = "external engine auto start"
561           select @dflt_status = @dflt_status + number from master.dbo.spt_values
562           where type = "A" and name = "no timeouts"
563       end
564       else
565       begin
566           /*
567           ** retrieve the value of the default security setting, namely
568           ** RPC security model A
569           */
570           select @dflt_status = number from master.dbo.spt_values
571           where type = "A" and name = "rpc security model A"
572   
573           select @dflt_status = @dflt_status + number from master.dbo.spt_values
574           where type = "A" and name = "no timeouts"
575       end
576   
577       /*
578       ** Default is for non-relocateable joins
579       */
580       select @dflt_status2 = 0
581   
582       /*
583       ** Default values for srvstatus2 
584       **
585       **		OPTION			VALUE	BIT
586       **		~~~~~~			~~~~~	~~~
587       **	enable login redirection	ON	0x00000002
588       **	cluster instance 		OFF	0x00000004
589       */
590       select @dflt_status2 = 2
591   
592       /*
593       **  If this is not the local server, then its srvid = max(srvid) + 1.
594       */
595       if lower(@class) != "local"
596       begin
597   
598           /*
599           ** 17295, "Adding server '%1!', physical name '%2!'"
600           */
601           exec sp_getmessage 17295, @msg output
602           print @msg, @lname, @pname
603   
604   
605           select @srvid = isnull(max(srvid), 0) + 1
606           from master.dbo.sysservers where srvid != 999
607   
608           /*
609           ** Set the default cost for remote servers
610           */
611           select @srvcost = 1000
612   
613   
614           if (@isrtds = 1)
615               begin tran rtds_dyn
616           if (@backupejbflag = 1)
617           begin
618               insert into master.dbo.sysservers
619               (srvid, srvstatus, srvname, srvnetname, srvclass, srvcost, srvstatus2)
620               values (@remotesrvid, @dflt_status, @lname, @pname, @newclass, @srvcost, @dflt_status2)
621           end
622           else
623           begin
624               insert into master.dbo.sysservers
625               (srvid, srvstatus, srvname, srvnetname, srvclass, srvcost, srvstatus2)
626               values (@srvid, @dflt_status, @lname, @pname, @newclass, @srvcost, @dflt_status2)
627               if (@@error != 0)
628                   goto clean_all
629               if (@isrtds = 1)
630               begin
631                   if (@insysattributes = 1)
632                   begin
633                       update master.dbo.sysattributes
634                       set int_value = @newclass, char_value = @pname,
635                           object = @srvid
636                       where class = 21 and attribute = 10
637                           and object_type = 'PR'
638                           and object_cinfo = @lname
639                   end
640                   else
641                   begin
642                       insert master.dbo.sysattributes
643                       (class, attribute, object_type, object_cinfo,
644                           object, int_value, char_value)
645                       values (21, 10, 'PR', @lname, @srvid, @newclass, @pname)
646                   end
647                   if (@@error != 0)
648                       goto clean_all
649                   commit tran rtds_dyn
650               end
651           end
652   
653   
654   
655       end
656   
657       /*
658       **  If @class = "local" then this is the local server and it's
659       **  srvid = 0.
660   
661       */
662       else
663       begin
664           if lower(@class) != "local"
665           begin
666               /*
667               ** 17291, "Usage: sp_addserver servername [, 'local | NULL'],
668               **	   [, physical_name]"
669               */
670               raiserror 17291
671               goto clean_all
672           end
673   
674           if exists (select *
675                   from master.dbo.sysservers
676                   where srvid = 0)
677           begin
678               /*
679               ** 17292, "There is already a local server."
680               */
681               raiserror 17292
682               goto clean_all
683           end
684   
685           if (@@clustermode = "shared disk cluster")
686           begin
687               if @lname != @@clustername
688               begin
689                   /*
690                   ** 19972, "Local server must use the cluster name as the server name."
691                   */
692                   raiserror 19972
693                   goto clean_all
694               end
695           end
696   
697           /*
698           ** 17295, "Adding server '%1!', physical name '%2!'"
699           */
700           exec sp_getmessage 17295, @msg output
701           print @msg, @lname, @pname
702   
703           insert into master.dbo.sysservers
704           (srvid, srvstatus, srvname, srvnetname, srvclass, srvcost, srvstatus2)
705           values (0, @dflt_status, @lname, @pname, 0, 0, @dflt_status2)
706       end
707   
708   
709       /*
710       ** log the command for replication support
711       ** except when adding an HADR member
712       */
713       if (@master_is_rep > 0) and (@class != "HADR_MEMBER") and
714           not exists (select *
715               from master.dbo.sysservers
716               where (srvname = @lname or srvname = @lname + "DR")
717                   and srvclass = (select number
718                       from master.dbo.spt_values
719                       where type = 'X' and lower(name) = lower("HADR_MEMBER")))
720       begin
721           if (logexec(1) != 1)
722           begin
723               /*
724               ** , "17869 Stored procedure %1 failed'
725               **       because '%2' failed in database '%3'."
726               */
727               raiserror 17869, "sp_addserver", "logexec()", @dbname
728               goto clean_all
729           end
730       end
731   
732       /*
733       ** 17293, "Server added."
734       */
735       exec sp_getmessage 17293, @msg output
736       print @msg
737   
738   commit_all:
739       commit tran rs_logexec
740       return (0)
741   
742   
743   clean_all:
744       if (@isrtds = 1) or (@leavertds = 1)
745           rollback tran rtds_dyn
746   
747       rollback tran rs_logexec
748       return (1)
749   


exec sp_procxmode 'sp_addserver', 'AnyMode'
go

Grant Execute on sp_addserver to public
go
DEFECTS
 MCTR 4 Conditional Begin Tran or Commit Tran 403
 MCTR 4 Conditional Begin Tran or Commit Tran 408
 MCTR 4 Conditional Begin Tran or Commit Tran 501
 MCTR 4 Conditional Begin Tran or Commit Tran 615
 MCTR 4 Conditional Begin Tran or Commit Tran 649
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 MTYP 4 Assignment type mismatch @newclass: smallint = int 238
 MTYP 4 Assignment type mismatch @srvclass: smallint = int 372
 MTYP 4 Assignment type mismatch @srvid: smallint = int 373
 MTYP 4 Assignment type mismatch @dflt_status: smallint = int 559
 MTYP 4 Assignment type mismatch @dflt_status: smallint = int 570
 MTYP 4 Assignment type mismatch srvname: varchar(30) = varchar(255) 620
 MTYP 4 Assignment type mismatch srvstatus2: uint = int 620
 MTYP 4 Assignment type mismatch srvname: varchar(30) = varchar(255) 626
 MTYP 4 Assignment type mismatch srvstatus2: uint = int 626
 MTYP 4 Assignment type mismatch srvname: varchar(30) = varchar(255) 705
 MTYP 4 Assignment type mismatch srvstatus2: uint = int 705
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
240
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
560
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
562
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
571
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
574
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
719
 QTYP 4 Comparison type mismatch Comparison type mismatch: uint vs int 291
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 344
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 376
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 413
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 424
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs smallint 470
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 540
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 606
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 636
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 676
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 717
 QTYP 4 Comparison type mismatch smallint = int 717
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 VRUN 4 Variable is read and not initialized @remotesrvid 620
 CUNU 3 Cursor not updated: cursor should contain 'for read only' clause instancenames 291
 MAW1 3 Warning message on %name% master..syscolumns.id: Warning message on syscolumns 205
 MAW1 3 Warning message on %name% master..syscolumns.id: Warning message on syscolumns 279
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysattributes  
 MGTP 3 Grant to public master..syscolumns  
 MGTP 3 Grant to public master..sysservers  
 MGTP 3 Grant to public sybsystemprocs..sp_addserver  
 MNER 3 No Error Check should check return value of exec 177
 MNER 3 No Error Check should check return value of exec 188
 MNER 3 No Error Check should check @@error after update 422
 MNER 3 No Error Check should check @@error after insert 428
 MNER 3 No Error Check should check return value of exec 458
 MNER 3 No Error Check should check return value of exec 496
 MNER 3 No Error Check should check return value of exec 601
 MNER 3 No Error Check should check @@error after insert 618
 MNER 3 No Error Check should check @@error after update 633
 MNER 3 No Error Check should check @@error after insert 642
 MNER 3 No Error Check should check return value of exec 700
 MNER 3 No Error Check should check @@error after insert 703
 MNER 3 No Error Check should check return value of exec 735
 MUCO 3 Useless Code Useless Brackets 116
 MUCO 3 Useless Code Useless Brackets 117
 MUCO 3 Useless Code Useless Brackets 127
 MUCO 3 Useless Code Useless Brackets 133
 MUCO 3 Useless Code Useless Brackets 145
 MUCO 3 Useless Code Useless Brackets 158
 MUCO 3 Useless Code Useless Brackets 180
 MUCO 3 Useless Code Useless Brackets 181
 MUCO 3 Useless Code Useless Brackets 182
 MUCO 3 Useless Code Useless Brackets 186
 MUCO 3 Useless Code Useless Brackets 194
 MUCO 3 Useless Code Useless Brackets 202
 MUCO 3 Useless Code Useless Brackets 213
 MUCO 3 Useless Code Useless Brackets 220
 MUCO 3 Useless Code Useless Brackets 222
 MUCO 3 Useless Code Useless Brackets 228
 MUCO 3 Useless Code Useless Brackets 247
 MUCO 3 Useless Code Useless Brackets 261
 MUCO 3 Useless Code Useless Brackets 286
 MUCO 3 Useless Code Useless Brackets 297
 MUCO 3 Useless Code Useless Brackets 312
 MUCO 3 Useless Code Useless Brackets 318
 MUCO 3 Useless Code Useless Brackets 327
 MUCO 3 Useless Code Useless Brackets 335
 MUCO 3 Useless Code Useless Brackets 384
 MUCO 3 Useless Code Useless Brackets 387
 MUCO 3 Useless Code Useless Brackets 410
 MUCO 3 Useless Code Useless Brackets 415
 MUCO 3 Useless Code Useless Brackets 419
 MUCO 3 Useless Code Useless Brackets 421
 MUCO 3 Useless Code Useless Brackets 433
 MUCO 3 Useless Code Useless Brackets 442
 MUCO 3 Useless Code Useless Brackets 448
 MUCO 3 Useless Code Useless Brackets 466
 MUCO 3 Useless Code Useless Brackets 490
 MUCO 3 Useless Code Useless Brackets 507
 MUCO 3 Useless Code Useless Brackets 511
 MUCO 3 Useless Code Useless Brackets 522
 MUCO 3 Useless Code Useless Brackets 524
 MUCO 3 Useless Code Useless Brackets 614
 MUCO 3 Useless Code Useless Brackets 616
 MUCO 3 Useless Code Useless Brackets 627
 MUCO 3 Useless Code Useless Brackets 629
 MUCO 3 Useless Code Useless Brackets 631
 MUCO 3 Useless Code Useless Brackets 647
 MUCO 3 Useless Code Useless Brackets 685
 MUCO 3 Useless Code Useless Brackets 721
 MUCO 3 Useless Code Useless Brackets 740
 MUCO 3 Useless Code Useless Brackets 748
 MUPK 3 Update column which is part of a PK or unique index object 634
 QAFM 3 Var Assignment from potentially many rows 204
 QAFM 3 Var Assignment from potentially many rows 238
 QAFM 3 Var Assignment from potentially many rows 278
 QAFM 3 Var Assignment from potentially many rows 372
 QAFM 3 Var Assignment from potentially many rows 468
 QAFM 3 Var Assignment from potentially many rows 538
 QAFM 3 Var Assignment from potentially many rows 559
 QAFM 3 Var Assignment from potentially many rows 561
 QAFM 3 Var Assignment from potentially many rows 570
 QAFM 3 Var Assignment from potentially many rows 573
 QISO 3 Set isolation level 164
 QIWC 3 Insert with not all columns specified missing 8 columns out of 15 429
 QIWC 3 Insert with not all columns specified missing 2 columns out of 9 619
 QIWC 3 Insert with not all columns specified missing 2 columns out of 9 625
 QIWC 3 Insert with not all columns specified missing 8 columns out of 15 643
 QIWC 3 Insert with not all columns specified missing 2 columns out of 9 704
 QPNC 3 No column in condition 540
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
205
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
279
 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: {object_type, object_cinfo, attribute, class}
344
 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: {object_type, object_cinfo, attribute, class}
376
 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: {object_type, object_cinfo, attribute, class}
413
 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: {object_type, object_cinfo, attribute, class}
424
 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: {object_type, object_cinfo, attribute, class}
636
 QSWV 3 Sarg with variable @srvclass, Candidate Index: spt_values.spt_valuesclust clustered(number, type) F 470
 VNRD 3 Variable is not read @gp_enabled 189
 VNRD 3 Variable is not read @dummy 192
 VNRD 3 Variable is not read @dupsrvclass 538
 VUNU 3 Variable is not used @end_code 87
 CUPD 2 Updatable Cursor Marker (updatable by default) 291
 MSUB 2 Subquery Marker 300
 MSUB 2 Subquery Marker 343
 MSUB 2 Subquery Marker 358
 MSUB 2 Subquery Marker 674
 MSUB 2 Subquery Marker 714
 MSUB 2 Subquery Marker 717
 MTR1 2 Metrics: Comments Ratio Comments: 45% 66
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 90 = 99dec - 11exi + 2 66
 MTR3 2 Metrics: Query Complexity Complexity: 368 66

DATA PROPAGATION detailed
ColumnWritten To
@lnamesysattributes.object_cinfo   °.char_value   sysservers.srvname   °.srvnetname   sysattributes.int_value   °.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteusername sp_checknames_rset_007.srvname sp_checkreswords_rset_001.Owner
sp_checkreswords_rset_002.Table sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.status sp_forceonline_object_rset_002.status sp_forceonline_page_rset_001.status sp_forceonline_page_rset_002.status sp_listsuspect_object_rset_001.Access sp_listsuspect_page_rset_001.Access sp_makesuspect_obj_rset_001.Indid °.LogType
°.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum
sp_makesuspect_obj_rset_003.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_optgoal_rset_002.name sp_passwordpolicy_rset_001.value °.message sp_passwordpolicy_rset_002.value
sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.js_server °.host_name sp_setsuspect_granularity_rset_001.Online mode sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@pnamesysattributes.char_value   sysservers.srvnetname   sysattributes.int_value   °.char_value   sp_dropdevice_rset_001.device sp_checkreswords_rset_001.Owner sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.status sp_forceonline_object_rset_002.status sp_forceonline_page_rset_001.status
sp_forceonline_page_rset_002.status sp_listsuspect_object_rset_001.Access sp_listsuspect_page_rset_001.Access sp_makesuspect_obj_rset_001.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Indid °.LogType °.PageType °.ErrType °.Delay
°.TotalNum sp_passwordpolicy_rset_001.message sp_passwordpolicy_rset_002.value sp_passwordpolicy_rset_003.value sp_passwordpolicy_rset_004.Policy_option sp_rjs_retrieve_rset_001.host_name sp_setsuspect_granularity_rset_001.Online mode sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..sysconfigures (1)  
   reads table master..syscurconfigs (1)  
reads table master..syscolumns (1)  
read_writes table master..sysattributes (1)  
calls proc sybsystemprocs..sp_ha_check_certified  
   reads table tempdb..sysobjects (1)  
read_writes table master..sysservers (1)  
calls proc sybsystemprocs..sp_getmessage  
   reads table master..syslanguages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)  
   reads table sybsystemprocs..sysusermessages  
reads table master..spt_values (1)