DatabaseProcApplicationCreatedLinks
sybsystemprocssp_addlogin  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/addlogin */
4     
5     /*
6     ** Generated by spgenmsgs.pl on Thu Feb  2 00:39:14 2006 
7     */
8     /*
9     ** raiserror Messages for addlogin [Total 12]
10    **
11    ** 17201, "'%1!' is not an official language name from syslanguages."
12    ** 17240, "'%1!' is not a valid name."
13    ** 17260, "Can't run %1! from within a transaction."
14    ** 17262, "A user with the specified login name already exists."
15    ** 17263, "Database name not valid -- login not added."
16    ** 17265, "A role with the specified name '%1!' already exists in this Server."
17    ** 17267, "Invalid value specified for %1! option. Login not created."
18    ** 17756, "The execution of the stored procedure '%1!' in database '%2!' was aborted because there was an error in writing the replication log record."
19    ** 18409, "The built-in function %1! failed. Please see the other messages printed along with this message."
20    ** 18773, "HA_LOG: HA consistency check failure in stored procedure '%1!' on the companion server '%2!'."
21    ** 18881, "Unable to generate %1! for HA use. Please Refer to documentation for details."
22    ** 19257, "The authentication mechanism '%1!' is not valid."
23    ** 19822, "A local temporary database is not permitted as the default database for a login."
24    */
25    /*
26    ** sp_getmessage Messages for addlogin [Total 3]
27    **
28    ** 17262, "A user with the specified login name already exists."
29    ** 17264, "New login created."
30    ** 19259, "Warning. Authentication mechanism '%1!' is not enabled."
31    ** 19446, "A login mapping for the name '%1!' already exists in this Server.
32    **		Drop an existing mapping before creating a new mapping."
33    ** 19448, "An existing login mapping for user '%1!' allows only '%2!' authentication mechanism to be used."
34    ** 18388, "You must be in the master database in order to run '%1!'."
35    */
36    /*
37    ** End spgenmsgs.pl output.
38    */
39    
40    /* 
41    ** IMPORTANT: Please read the following instructions before
42    **   making changes to this stored procedure.
43    **
44    **	To make this stored procedure compatible with High Availability (HA),
45    **	changes to certain system tables must be propagated 
46    **	to the companion server under some conditions.
47    **	The tables include (but are not limited to):
48    **		syslogins, sysservers, sysattributes, systimeranges,
49    **		sysresourcelimits, sysalternates, sysdatabases,
50    **		syslanguages, sysremotelogins, sysloginroles,
51    **		sysalternates (master DB only), systypes (master DB only),
52    **		sysusers (master DB only), sysprotects (master DB only)
53    **	please refer to the HA documentation for detail.
54    **
55    **	Here is what you need to do: 
56    **	For each insert/update/delete statement, add three sections to
57    **	-- start HA transaction prior to the statement
58    **	-- add the statement
59    **	-- add HA synchronization code to propagate the change to the companion
60    **
61    **	For example, if you are adding 
62    **		insert master.dbo.syslogins ......
63    **	the code should look like:
64    **	1. Before that SQL statement:
65    **		
66    **	2. Now, the SQL statement:
67    **		insert master.dbo.syslogins ......
68    **	3. Add a HA synchronization section right after the SQL statement:
69    **		
70    **
71    **	You may need to do similar change for each built-in function you
72    **	want to add.
73    **
74    **	Finally, add a separate part at a place where it can not
75    **	be reached by the normal execution path:
76    **	clean_all:
77    **		
78    **		return (1)
79    */
80    
81    create or replace procedure sp_addlogin
82        @loginame varchar(255), /* login name of the new user */
83        @passwd varchar(256) = NULL, /* password of the new user */
84        @defdb varchar(255) = "master", /* default db for the new user */
85        @deflanguage varchar(255) = NULL, /* default language for the new user */
86        @fullname varchar(255) = NULL, /* account owner's full name */
87        @passwdexp int = NULL, /* value of password expiration */
88        @minpwdlen int = NULL, /* value of minimum password 
89        ** length 
90        */
91        @maxfailedlogins int = NULL, /* value of maximum failed 
92        ** logins
93        */
94        @auth_mech varchar(30) = "ANY" /* Authentication mechanism */
95    as
96    
97        declare @msg varchar(1024)
98        declare @dummy int,
99            @passeclass int, /* Class id in Sysattributes */
100           @attrib int, /* attribute id in 
101           ** Sysatttributes
102           */
103           @action int, /* Insert, update or delete 
104           ** Sysattributes entry
105           */
106           @retstat int,
107           @insertsuid int, /* suid corresponding to 
108           ** insert slot in Syslogins
109           */
110           @HA_CERTIFIED tinyint, /* Is the SP HA certified ? */
111           @authid int, /* auth mechanism id */
112           @config int, /* Config option for external
113           ** authentication mechanisms.
114           */
115           @status int, /* Syslogins status */
116           @curname varchar(30), /* To retrieve name from syslogins */
117           @login_class int, /* To retrieve mapping from
118           ** sysattributes. 
119           */
120           @login_attrib int, /* To retrieve mapping */
121           @map_authid int, /* sp_maplogin auth mechanism id */
122           @map_authnm varchar(30), /* sp_maplogin auth mechanism name */
123   
124           @maxlen int,
125           @log_for_rep int,
126           @db_rep_level_all int,
127           @db_rep_level_none int,
128           @db_rep_level_l1 int,
129           @lt_rep_get_failed int,
130           @nullarg char(1),
131           @gp_enabled int
132   
133   
134   
135   
136       /* 
137       ** HA uses sp_halockclustertables procedure to handle concurrency.
138       ** Use of cursors in a HA cluster leads to a significant drop in the
139       ** addlogin performance.
140       */
141       declare sync_cursor cursor for select name from master.dbo.syslogins holdlock for update
142   
143   
144       /*
145       ** Initialize some constants
146       */
147       select @db_rep_level_all = - 1,
148           @db_rep_level_none = 0,
149           @db_rep_level_l1 = 1,
150           @lt_rep_get_failed = - 2
151   
152       select @HA_CERTIFIED = 0
153   
154   
155   
156       /* check to see if we are using HA specific SP for a HA enabled server */
157       exec @retstat = sp_ha_check_certified 'sp_addlogin', @HA_CERTIFIED
158       if (@retstat != 0)
159           return (1)
160   
161   
162       /*
163       ** Do not allow this system procedure to be run from within a transaction
164       ** to avoid creating a multi-database transaction where the 'master'
165       ** database is not the co-ordinating database.
166       */
167       if @@trancount > 0
168       begin
169           /*
170           ** 17260, "Can't run %1! from within a transaction."
171           */
172           raiserror 17260, "sp_addlogin"
173           return (1)
174       end
175       else
176       begin
177           set chained off
178       end
179       set transaction isolation level 1
180   
181       /*
182       ** Get the replication status of the 'master' database
183       */
184       select @log_for_rep = getdbrepstat(1)
185       if (@log_for_rep = @lt_rep_get_failed)
186       begin
187           raiserror 18409, "getdbrepstat"
188           return (1)
189       end
190   
191       /*
192       ** Convert the replication status to a boolean
193       */
194       if (@log_for_rep != @db_rep_level_none)
195           select @log_for_rep = 1
196       else
197           select @log_for_rep = 0
198   
199       /*
200       ** If we are logging this system procedure for replication, we must be in
201       ** the 'master' database to avoid creating a multi-database transaction
202       ** which could make recovery of the 'master' database impossible.
203       */
204       if (@log_for_rep = 1) and (db_name() != "master")
205       begin
206           /*
207           ** 18388, "You must be in the master database in order to run '%1!'."
208           */
209           raiserror 18388, "sp_addlogin"
210           return (1)
211       end
212   
213       /* 
214       ** If granular permissions is not enabled then sso_role is required.
215       ** If granular permissions is enabled then the permission 'manage any login' is
216       ** required.  proc_role and proc_auditperm will also do auditing
217       ** if required. Both will also print error message if required.
218       */
219   
220       select @nullarg = NULL
221       execute @status = sp_aux_checkroleperm "sso_role", "manage any login",
222           @nullarg, @gp_enabled output
223   
224       /* For Auditing */
225       if (@gp_enabled = 0)
226       begin
227           if (proc_role("sso_role") = 0)
228               return (1)
229       end
230       else
231       begin
232           select @dummy = proc_auditperm("manage any login", @status)
233       end
234   
235       if (@status != 0)
236           return (1)
237   
238       declare @returncode int
239   
240       /*
241       **  Check to see that the @loginame is valid.
242       */
243       if (@loginame is not null)
244       begin
245           select @maxlen = length from master.dbo.syscolumns
246           where id = object_id("master.dbo.syslogins") and name = "name"
247   
248           if (valid_name(@loginame, @maxlen) = 0) or
249               (@loginame = 'dbo')
250           begin
251               /*
252               ** 17240, "'%1!' is not a valid name." 
253               */
254               raiserror 17240, @loginame
255               return 1
256           end
257       end
258   
259       /*
260       ** Check to see that the @fullname is valid.
261       */
262       if (@fullname is not NULL)
263       begin
264           select @maxlen = length from master.dbo.syscolumns
265           where id = object_id("master.dbo.syslogins") and name = "fullname"
266   
267           if char_length(@fullname) > @maxlen
268           begin
269               /*
270               ** 17240, "'%1!' is not a valid name."
271               */
272               raiserror 17240, @fullname
273               return 1
274           end
275       end
276   
277       if @deflanguage is not null
278       begin
279           select @returncode = 0
280           execute @returncode = sp_validlang @deflanguage
281           if @returncode != 0
282           begin
283               /* Us_english is always valid */
284               if @deflanguage != "us_english"
285               begin
286                   /*
287                   ** 17201, "'%1!' is not an official language name from Syslanguages." 
288                   */
289                   raiserror 17201, @deflanguage
290                   return @returncode
291               end
292           end
293       end
294   
295   
296       open sync_cursor
297       /*
298       ** To serialize concurrent sp_addlogin requests
299       */
300       fetch sync_cursor into @curname
301   
302   
303       /*
304       **  Make sure the login or login profile name doesn't already exist.
305       */
306       if exists (select *
307               from master.dbo.syslogins(index ncsyslogins)
308               where name = @loginame)
309       begin
310           /*
311           ** 17262, "A user with the specified login name already exists."
312           */
313           raiserror 17262
314           return (1)
315       end
316   
317       /*
318       ** Make sure role doesn't already exist with this name.
319       */
320       if exists (select *
321               from master.dbo.syssrvroles
322               where name = @loginame)
323       begin
324           /*
325           ** 17265, "A role with the specified name '%1!' already exists in this
326           **	   Server."
327           */
328           raiserror 17265, @loginame
329           return (1)
330       end
331   
332       /*
333       ** Make sure a login mapping doesn't already exist for this name.
334       ** Prevent a login from being added if there already exists a 
335       ** mapping that may obscure the login. This helps to avoid
336       ** another way to alias a user within ASE.
337       */
338       select @login_class = 20, @login_attrib = 0
339   
340       if exists (select 1 from master.dbo.sysattributes where
341                   class = @login_class and attribute = @login_attrib and
342                   object_cinfo = @loginame)
343       begin
344           /*
345           ** 19446, "A login mapping for the name '%1!' already exists in this
346           **	   Server.  Drop an existing mapping before creating a new 
347           **	   mapping."
348           */
349           raiserror 19446, @loginame
350           return (1)
351       end
352   
353       /*
354       **  Check that the database name is valid.
355       **  If it was specified as NULL then default it to "master".  Note that this
356       **  can happen for 'sp_addlogin peter, password, null, null, "peter rabbit"'
357       **  but not for 'sp_addlogin peter, password, @fullname = "peter rabbit"'.
358       */
359       if @defdb is NULL
360       begin
361           select @defdb = "master"
362       end
363   
364       if not exists (select *
365               from master.dbo.sysdatabases
366               where name = @defdb)
367       begin
368           /*
369           ** 17263, "Database name not valid -- login not added."
370           */
371           raiserror 17263
372           return (1)
373       end
374   
375       /*
376       **  Check that the database name is useable on all instances of cluster.
377       **  If specified default database is a local temporary database then
378       **  fail the command to avoid problems at connection time.
379       */
380       if db_instanceid(db_id(@defdb)) is not null
381       begin
382           /*
383           ** 19822, "A local temporary database is not permitted as the 
384           ** default database for a login."
385           */
386           raiserror 19822
387           return (1)
388       end
389   
390       /* Assign the class number for the 
391       ** PASSWORD_SECURITY class in
392       ** master.dbo.sysattributes
393       */
394       select @passeclass = 14
395   
396   
397   
398       exec @retstat = sp_gen_login_id @loginame, @insertsuid output
399       if (@retstat != 0)
400           goto clean_all
401   
402   
403   
404       /*
405       ** delete entries for local mapped logins 
406       ** from sysattributes for this login.  
407       ** This will cleanup the rows having stale object suid 
408       ** equal to this newly generated suid (insertsuid) 
409       */
410       delete from master.dbo.sysattributes
411       where object = @insertsuid
412           and object_type = "LM"
413   
414   
415   
416       /* If any of the password options have been
417       ** specified, check for validity & insert
418       ** appropriate entry in Sysattributes
419       */
420       if @passwdexp is not NULL
421       begin
422           select @attrib = 0,
423               @action = 1
424           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
425                   NULL, NULL, NULL, "login", @passwdexp, NULL, NULL, NULL,
426                   NULL, @action) = 0
427           begin
428               /*
429               ** 17267, "Invalid 'password expiration' attribute specified.
430               ** Login not created."
431               */
432               raiserror 17267, "password expiration"
433               goto clean_all
434           end
435           else
436           begin
437               insert into master.dbo.sysattributes(class, attribute,
438                   object_type, object_cinfo, object, int_value)
439               values
440               (@passeclass, @attrib, "PS", "login", @insertsuid, @passwdexp)
441   
442   
443   
444           end
445       end
446   
447       if @minpwdlen is not NULL
448       begin
449           select @attrib = 1,
450               @action = 1
451           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
452                   NULL, NULL, NULL, "login", @minpwdlen, NULL, NULL, NULL,
453                   NULL, @action) = 0
454           begin
455               /* 
456               ** 17267, "Incorrect 'minimum password length' attribute
457               ** specified. Login not created."
458               */
459               raiserror 17267, "minimum password length"
460               goto clean_all
461           end
462           else
463           begin
464               insert into master.dbo.sysattributes(class, attribute,
465                   object_type, object_cinfo, object, int_value)
466               values
467               (@passeclass, @attrib, "PS", "login", @insertsuid,
468                   @minpwdlen)
469   
470   
471   
472           end
473       end
474   
475   
476       if @maxfailedlogins is not NULL
477       begin
478           select @attrib = 2,
479               @action = 1
480           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
481                   NULL, NULL, NULL, "login", @maxfailedlogins, NULL, NULL,
482                   NULL, NULL, @action) = 0
483           begin
484               /* 
485               ** 17267, "Incorrect 'maximum failed logins' specified.
486               ** Login not created."
487               */
488               raiserror 17267, "maximum failed logins"
489               goto clean_all
490           end
491           else
492           begin
493               insert into master.dbo.sysattributes(class, attribute,
494                   object_type, object_cinfo, object, int_value)
495               values
496               (@passeclass, @attrib, "PS", "login", @insertsuid,
497                   @maxfailedlogins)
498   
499   
500   
501           end
502       end
503   
504       /*
505       ** Check whether authentication mechanism specified is valid or not.
506       ** 'AUTH_DEFAULT' and 'AUTH_MASK' are new values added in spt_values
507       ** used to obtain value of default ('ANY') authmech or authentication
508       ** mask respectively. They are not valid names that the user can specify
509       ** as authentication mechanism.
510       */
511       select @authid = low, @config = number
512       from master.dbo.spt_values
513       where type = 'ua' and name = upper(@auth_mech) and
514           upper(@auth_mech) not in ('AUTH_DEFAULT', 'AUTH_MASK')
515   
516       if @@rowcount = 0
517       begin
518           /*
519           ** 19257, "The authentication mechanism '%1!' is not valid."
520           */
521           raiserror 19257, @auth_mech
522           goto clean_all
523       end
524   
525       /*
526       ** If authmech is 'ANY', then obtain the value of default authmech
527       ** 'ASE_DEFAULT' defined in spt_values.
528       */
529       if (upper(@auth_mech) = "ANY")
530       begin
531           select @authid = low from master.dbo.spt_values
532           where type = 'ua' and name = "AUTH_DEFAULT"
533       end
534   
535       /*
536       ** Check if the authentication method is enabled.
537       */
538       if (@config != 0) and not exists (select 1
539               from master.dbo.syscurconfigs a
540               where a.config = @config and a.value != 0)
541       begin
542           /*
543           ** 19259, "Warning. Authentication mechanism '%1!' is not enabled."
544           */
545           exec sp_getmessage 19259, @msg output
546           print @msg, @auth_mech
547       end
548   
549       /* Set status to LOGIN_LOCKED | Authentication mask */
550       select @status = 2 | @authid
551   
552       /*
553       **  Create the login.  Lock the account temporarily and
554       **  Put in a dont-care NULL as password.
555       */
556       insert into master.dbo.syslogins(suid, status, accdate, totcpu, totio,
557           spacelimit, timelimit, resultlimit,
558           dbname, name, password, language,
559           pwdate, audflags, fullname)
560       values (@insertsuid, @status, getdate(), 0, 0, 0, 0, 0,
561           @defdb, @loginame, NULL, @deflanguage,
562           getdate(), 0, @fullname)
563   
564   
565   
566   
567   
568       /*
569       **  Encrypt and store the input password
570       */
571       execute @returncode = sp_password NULL, @passwd, @loginame
572   
573   
574   
575       if (@returncode = 0)
576       begin
577           /*
578           ** Before we log our system procedure execution instance,
579           ** re-initialize the '@password' parameter to the encrypted form of
580           ** the password.  This prevents the password from being stored in
581           ** clear text in the transaction log as well as in the Replication
582           ** Server stable queues.
583           **
584           ** When the ASE RepAgent Thread sends the system procedure
585           ** execution instance to the Replication Server, the ASE RepAgent
586           ** will re-name the system procedure from 'sp_addlogin()' to
587           ** 'sp_addlogin_rep()'.  This will cause the Replication Server to
588           ** execute, at the target ASE, the system procedure
589           ** 'sp_addlogin_rep()' which knows how to properly process the
590           ** encrypted password.
591           */
592           select @passwd = password
593           from master.dbo.syslogins
594           where suid = @insertsuid
595   
596           /*
597           ** If the 'master' database is marked for replication, the T-SQL
598           ** built-in 'logexec()' will log for replication the execution
599           ** instance of this system procedure.  Otherwise, the T-SQL
600           ** built-in 'logexec()' is a no-op.
601           */
602           if (logexec(1) != 1)
603           begin
604               raiserror 17756, "sp_addlogin", "master"
605               select @returncode = 1
606           end
607       end
608   
609       if @returncode = 0
610       begin
611           /* UN-lock the account after successful update */
612           /* except in case of user sybmail a MAPI requirement. */
613           if (@loginame != "sybmail")
614           begin
615               execute @returncode = sp_locklogin @loginame, "unlock"
616   
617           end
618       end
619       else
620       begin
621           /*
622           ** Delete relevant syslogins and sysattribute login information
623           ** for this login, in order to backout.
624           */
625           delete from master.dbo.syslogins where name = @loginame
626           delete from master.dbo.sysattributes
627           where class = @passeclass AND object = @insertsuid
628               AND object_cinfo = "login"
629   
630   
631   
632       end
633   
634       if @returncode = 0
635       begin
636           /*
637           ** 17264, "New login created."
638           */
639           exec sp_getmessage 17264, @msg output
640           print @msg
641       end
642   
643   
644       close sync_cursor
645       deallocate cursor sync_cursor
646   
647       return (@returncode)
648   
649   clean_all:
650   
651       return (1)
652   


exec sp_procxmode 'sp_addlogin', 'AnyMode'
go

Grant Execute on sp_addlogin to public
go
DEFECTS
 MINU 4 Unique Index with nullable columns master..sysattributes master..sysattributes
 MTYP 4 Assignment type mismatch @loginame: varchar(30) = varchar(255) 398
 MTYP 4 Assignment type mismatch attribute: smallint = int 440
 MTYP 4 Assignment type mismatch class: smallint = int 440
 MTYP 4 Assignment type mismatch attribute: smallint = int 467
 MTYP 4 Assignment type mismatch class: smallint = int 467
 MTYP 4 Assignment type mismatch attribute: smallint = int 496
 MTYP 4 Assignment type mismatch class: smallint = int 496
 MTYP 4 Assignment type mismatch status: smallint = int 560
 MTYP 4 Assignment type mismatch dbname: sysname = varchar(255) 561
 MTYP 4 Assignment type mismatch language: varchar(30) = varchar(255) 561
 MTYP 4 Assignment type mismatch name: sysname = varchar(255) 561
 MTYP 4 Assignment type mismatch fullname: varchar(30) = varchar(255) 562
 MTYP 4 Assignment type mismatch @loginame: varchar(30) = varchar(255) 615
 QPUI 4 Join or Sarg with Un-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}
411
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
513
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
532
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 341
 QTYP 4 Comparison type mismatch smallint = int 341
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 540
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 627
 QTYP 4 Comparison type mismatch smallint = int 627
 TNOI 4 Table with no index master..syscurconfigs master..syscurconfigs
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 CUSU 3 Cursor updated through 'searched update': risk of halloween rows sync_cursor 556
 CUSU 3 Cursor updated through 'searched update': risk of halloween rows sync_cursor 625
 MAW1 3 Warning message on %name% master..syscolumns.id: Warning message on syscolumns 246
 MAW1 3 Warning message on %name% master..syscolumns.id: Warning message on syscolumns 265
 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..syscurconfigs  
 MGTP 3 Grant to public master..sysdatabases  
 MGTP 3 Grant to public master..syslogins  
 MGTP 3 Grant to public master..syssrvroles  
 MGTP 3 Grant to public sybsystemprocs..sp_addlogin  
 MNER 3 No Error Check should check @@error after delete 410
 MNER 3 No Error Check should check @@error after insert 437
 MNER 3 No Error Check should check @@error after insert 464
 MNER 3 No Error Check should check @@error after insert 493
 MNER 3 No Error Check should check return value of exec 545
 MNER 3 No Error Check should check @@error after insert 556
 MNER 3 No Error Check should check return value of exec 615
 MNER 3 No Error Check should check @@error after delete 625
 MNER 3 No Error Check should check @@error after delete 626
 MNER 3 No Error Check should check return value of exec 639
 MUCO 3 Useless Code Useless Brackets 158
 MUCO 3 Useless Code Useless Brackets 159
 MUCO 3 Useless Code Useless Brackets 173
 MUCO 3 Useless Code Useless Brackets 185
 MUCO 3 Useless Code Useless Brackets 188
 MUCO 3 Useless Code Useless Brackets 194
 MUCO 3 Useless Code Useless Brackets 210
 MUCO 3 Useless Code Useless Brackets 225
 MUCO 3 Useless Code Useless Brackets 227
 MUCO 3 Useless Code Useless Brackets 228
 MUCO 3 Useless Code Useless Brackets 235
 MUCO 3 Useless Code Useless Brackets 236
 MUCO 3 Useless Code Useless Brackets 243
 MUCO 3 Useless Code Useless Brackets 262
 MUCO 3 Useless Code Useless Brackets 314
 MUCO 3 Useless Code Useless Brackets 329
 MUCO 3 Useless Code Useless Brackets 350
 MUCO 3 Useless Code Useless Brackets 372
 MUCO 3 Useless Code Useless Brackets 387
 MUCO 3 Useless Code Useless Brackets 399
 MUCO 3 Useless Code Useless Brackets 529
 MUCO 3 Useless Code Useless Brackets 575
 MUCO 3 Useless Code Useless Brackets 602
 MUCO 3 Useless Code Useless Brackets 613
 MUCO 3 Useless Code Useless Brackets 647
 MUCO 3 Useless Code Useless Brackets 651
 MUOT 3 Updates outside transaction 626
 QAFM 3 Var Assignment from potentially many rows 245
 QAFM 3 Var Assignment from potentially many rows 264
 QAFM 3 Var Assignment from potentially many rows 511
 QAFM 3 Var Assignment from potentially many rows 531
 QFID 3 Force index master..syslogins 307
 QISO 3 Set isolation level 179
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 437
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 464
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 493
 QIWC 3 Insert with not all columns specified missing 10 columns out of 25 556
 QPNC 3 No column in condition 514
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
246
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
265
 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, attribute, object_cinfo}
341
 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, class, object_cinfo}
627
 VNRD 3 Variable is not read @db_rep_level_all 147
 VNRD 3 Variable is not read @db_rep_level_l1 149
 VNRD 3 Variable is not read @dummy 232
 VNRD 3 Variable is not read @curname 300
 VNRD 3 Variable is not read @passwd 592
 VUNU 3 Variable is not used @map_authid 121
 VUNU 3 Variable is not used @map_authnm 122
 CUPD 2 Updatable Cursor Marker (has for update clause) 141
 MSUB 2 Subquery Marker 306
 MSUB 2 Subquery Marker 320
 MSUB 2 Subquery Marker 340
 MSUB 2 Subquery Marker 364
 MSUB 2 Subquery Marker 538
 MTR1 2 Metrics: Comments Ratio Comments: 55% 81
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 37 = 48dec - 13exi + 2 81
 MTR3 2 Metrics: Query Complexity Complexity: 204 81

DATA PROPAGATION detailed
ColumnWritten To
@defdbsyslogins.dbname   °.procid   sp_checknames_rset_010.name
@deflanguagesyslogins.language  
@fullnamesyslogins.fullname  
@loginamesyslogins.name   sp_checknames_rset_009.colname sp_checknames_rset_010.indid sp_checknames_rset_011.name sp_checkreswords_rset_008.Database-wide Objects sp_displayroles_rset_003.Parent Role Name sp_locklogin_rset_001.name sp_reportstats_rset_002.Name sp_reportstats_rset_003.Total CPU
@maxfailedloginssysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file 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 °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@minpwdlensysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file 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 °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference
@passwdexpsysattributes.object   °.object_info1   °.object_info3   °.int_value   °.char_value   sysremotelogins.remoteserverid   sysservers.srvid   sysattributes.object_info1   °.object_info3   °.int_value  
°.char_value   sp_dropdevice_rset_001.device sp_checknames_rset_006.remoteserverid sp_checknames_rset_007.srvid sp_checknames_rset_008.srvid sp_dbrecovery_order_rset_001.Database Name °.Database id °.Recovery Order sp_dbrecovery_order_rset_002.Recovery Order sp_displayroles_rset_001.Role Name
sp_displayroles_rset_002.Role Name °.Grantee sp_displayroles_rset_003.Role Name sp_displayroles_rset_004.Role Name sp_dropdevice_rset_001.device sp_forceonline_object_rset_001.Objid °.Object °.status sp_forceonline_object_rset_002.Objid °.Object
°.status sp_forceonline_page_rset_001.Pageid °.status sp_forceonline_page_rset_002.Pageid °.status sp_listsuspect_object_rset_001.Objid °.Object °.Access sp_listsuspect_page_rset_001.Pageid °.Object
°.Access sp_makesuspect_obj_rset_001.Obj °.Indid °.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_002.Obj °.Indid
°.LogType °.PageType °.ErrType °.Delay °.TotalNum sp_makesuspect_obj_rset_003.Obj °.Indid °.LogType °.PageType °.ErrType
°.Delay °.TotalNum sp_memlog_rset_001.dumps_per_file 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 °.host_port sp_setsuspect_error_rset_001.Error Num
sp_setsuspect_error_rset_002.Error Num sp_setsuspect_granularity_rset_001.Online mode sp_setsuspect_threshold_rset_001.Cur. Suspect threshold sp_setsuspect_threshold_rset_002.Cur. Suspect Threshold sp_ssladmin_rset_001.certificate_path sp_ssladmin_rset_002.Cipher Suite Name °.Preference

DEPENDENCIES
PROCS AND TABLES USED
reads table master..syssrvroles (1)  
reads table master..syscolumns (1)  
calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syscurconfigs (1)  
   reads table master..sysconfigures (1)  
calls proc sybsystemprocs..sp_getmessage  
   reads table master..sysmessages (1)  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
reads table master..syscurconfigs (1)  
calls proc sybsystemprocs..sp_validlang  
read_writes table master..syslogins (1)  
calls proc sybsystemprocs..sp_ha_check_certified  
   reads table tempdb..sysobjects (1)  
reads table master..sysdatabases (1)  
read_writes table master..sysattributes (1)  
calls proc sybsystemprocs..sp_password  
   calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..syslogins (1)  
   calls proc sybsystemprocs..sp_ha_check_certified  
calls proc sybsystemprocs..sp_locklogin  
   reads table master..sysprocesses (1)  
   read_writes table master..syslogins (1)  
   calls proc sybsystemprocs..sp_ha_check_certified  
   reads table master..sysattributes (1)  
   writes table sybsystemprocs..sp_locklogin_rset_001 
   reads table master..syssrvroles (1)  
   calls proc sybsystemprocs..sp_getmessage  
   calls proc sybsystemprocs..sp_aux_checkroleperm  
   reads table master..sysconfigures (1)  
   reads table master..sysloginroles (1)  
   writes table tempdb..#dummy_table (1) 
calls proc sybsystemprocs..sp_gen_login_id  
   reads table master..syslogins (1)  
reads table master..spt_values (1)