DatabaseProcApplicationCreatedLinks
sybsystemprocssp_addlogin  31 Aug 14Defects 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 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   
131   
132       /* 
133       ** HA uses sp_halockclustertables procedure to handle concurrency.
134       ** Use of cursors in a HA cluster leads to a significant drop in the
135       ** addlogin performance.
136       */
137       declare sync_cursor cursor for select name from master.dbo.syslogins holdlock for update
138   
139   
140       /*
141       ** Initialize some constants
142       */
143       select @db_rep_level_all = - 1,
144           @db_rep_level_none = 0,
145           @db_rep_level_l1 = 1,
146           @lt_rep_get_failed = - 2
147   
148       select @HA_CERTIFIED = 0
149   
150   
151   
152       /* check to see if we are using HA specific SP for a HA enabled server */
153       exec @retstat = sp_ha_check_certified 'sp_addlogin', @HA_CERTIFIED
154       if (@retstat != 0)
155           return (1)
156   
157   
158       /*
159       ** Do not allow this system procedure to be run from within a transaction
160       ** to avoid creating a multi-database transaction where the 'master'
161       ** database is not the co-ordinating database.
162       */
163       if @@trancount > 0
164       begin
165           /*
166           ** 17260, "Can't run %1! from within a transaction."
167           */
168           raiserror 17260, "sp_addlogin"
169           return (1)
170       end
171       else
172       begin
173           set chained off
174       end
175       set transaction isolation level 1
176   
177       /*
178       ** Get the replication status of the 'master' database
179       */
180       select @log_for_rep = getdbrepstat(1)
181       if (@log_for_rep = @lt_rep_get_failed)
182       begin
183           raiserror 18409, "getdbrepstat"
184           return (1)
185       end
186   
187       /*
188       ** Convert the replication status to a boolean
189       */
190       if (@log_for_rep != @db_rep_level_none)
191           select @log_for_rep = 1
192       else
193           select @log_for_rep = 0
194   
195       /*
196       ** If we are logging this system procedure for replication, we must be in
197       ** the 'master' database to avoid creating a multi-database transaction
198       ** which could make recovery of the 'master' database impossible.
199       */
200       if (@log_for_rep = 1) and (db_name() != "master")
201       begin
202           /*
203           ** 18388, "You must be in the master database in order to run '%1!'."
204           */
205           raiserror 18388, "sp_addlogin"
206           return (1)
207       end
208   
209       /* check if user has sso role, proc_role will also do auditing
210       ** if required. proc_role will also print error message if required.
211       */
212   
213       if (proc_role("sso_role") = 0)
214           return (1)
215   
216       declare @returncode int
217   
218       /*
219       **  Check to see that the @loginame is valid.
220       */
221       if (@loginame is not null)
222       begin
223           select @maxlen = length from master.dbo.syscolumns
224           where id = object_id("master.dbo.syslogins") and name = "name"
225   
226           if (valid_name(@loginame, @maxlen) = 0) or
227               (@loginame = 'dbo')
228           begin
229               /*
230               ** 17240, "'%1!' is not a valid name." 
231               */
232               raiserror 17240, @loginame
233               return 1
234           end
235       end
236   
237       /*
238       ** Check to see that the @fullname is valid.
239       */
240       if (@fullname is not NULL)
241       begin
242           select @maxlen = length from master.dbo.syscolumns
243           where id = object_id("master.dbo.syslogins") and name = "fullname"
244   
245           if char_length(@fullname) > @maxlen
246           begin
247               /*
248               ** 17240, "'%1!' is not a valid name."
249               */
250               raiserror 17240, @fullname
251               return 1
252           end
253       end
254   
255       if @deflanguage is not null
256       begin
257           select @returncode = 0
258           execute @returncode = sp_validlang @deflanguage
259           if @returncode != 0
260           begin
261               /* Us_english is always valid */
262               if @deflanguage != "us_english"
263               begin
264                   /*
265                   ** 17201, "'%1!' is not an official language name from Syslanguages." 
266                   */
267                   raiserror 17201, @deflanguage
268                   return @returncode
269               end
270           end
271       end
272   
273   
274       open sync_cursor
275       /*
276       ** To serialize concurrent sp_addlogin requests
277       */
278       fetch sync_cursor into @curname
279   
280   
281       /*
282       **  Make sure the login or login profile name doesn't already exist.
283       */
284       if exists (select *
285               from master.dbo.syslogins(index ncsyslogins)
286               where name = @loginame)
287       begin
288           /*
289           ** 17262, "A user with the specified login name already exists."
290           */
291           raiserror 17262
292           return (1)
293       end
294   
295       /*
296       ** Make sure role doesn't already exist with this name.
297       */
298       if exists (select *
299               from master.dbo.syssrvroles
300               where name = @loginame)
301       begin
302           /*
303           ** 17265, "A role with the specified name '%1!' already exists in this
304           **	   Server."
305           */
306           raiserror 17265, @loginame
307           return (1)
308       end
309   
310       /*
311       ** Make sure a login mapping doesn't already exist for this name.
312       ** Prevent a login from being added if there already exists a 
313       ** mapping that may obscure the login. This helps to avoid
314       ** another way to alias a user within ASE.
315       */
316       select @login_class = 20, @login_attrib = 0
317   
318       if exists (select 1 from master.dbo.sysattributes where
319                   class = @login_class and attribute = @login_attrib and
320                   object_cinfo = @loginame)
321       begin
322           /*
323           ** 19446, "A login mapping for the name '%1!' already exists in this
324           **	   Server.  Drop an existing mapping before creating a new 
325           **	   mapping."
326           */
327           raiserror 19446, @loginame
328           return (1)
329       end
330   
331       /*
332       **  Check that the database name is valid.
333       **  If it was specified as NULL then default it to "master".  Note that this
334       **  can happen for 'sp_addlogin peter, password, null, null, "peter rabbit"'
335       **  but not for 'sp_addlogin peter, password, @fullname = "peter rabbit"'.
336       */
337       if @defdb is NULL
338       begin
339           select @defdb = "master"
340       end
341   
342       if not exists (select *
343               from master.dbo.sysdatabases
344               where name = @defdb)
345       begin
346           /*
347           ** 17263, "Database name not valid -- login not added."
348           */
349           raiserror 17263
350           return (1)
351       end
352   
353       /*
354       **  Check that the database name is useable on all instances of cluster.
355       **  If specified default database is a local temporary database then
356       **  fail the command to avoid problems at connection time.
357       */
358       if db_instanceid(db_id(@defdb)) is not null
359       begin
360           /*
361           ** 19822, "A local temporary database is not permitted as the 
362           ** default database for a login."
363           */
364           raiserror 19822
365           return (1)
366       end
367   
368       /* Assign the class number for the 
369       ** PASSWORD_SECURITY class in
370       ** master.dbo.sysattributes
371       */
372       select @passeclass = 14
373   
374   
375   
376       exec @retstat = sp_gen_login_id @loginame, @insertsuid output
377       if (@retstat != 0)
378           goto clean_all
379   
380   
381   
382       /*
383       ** delete entries for local mapped logins 
384       ** from sysattributes for this login.  
385       ** This will cleanup the rows having stale object suid 
386       ** equal to this newly generated suid (insertsuid) 
387       */
388       delete from master.dbo.sysattributes
389       where object = @insertsuid
390           and object_type = "LM"
391   
392   
393   
394       /* If any of the password options have been
395       ** specified, check for validity & insert
396       ** appropriate entry in Sysattributes
397       */
398       if @passwdexp is not NULL
399       begin
400           select @attrib = 0,
401               @action = 1
402           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
403                   NULL, NULL, NULL, "login", @passwdexp, NULL, NULL, NULL,
404                   NULL, @action) = 0
405           begin
406               /*
407               ** 17267, "Invalid 'password expiration' attribute specified.
408               ** Login not created."
409               */
410               raiserror 17267, "password expiration"
411               goto clean_all
412           end
413           else
414           begin
415               insert into master.dbo.sysattributes(class, attribute,
416                   object_type, object_cinfo, object, int_value)
417               values
418               (@passeclass, @attrib, "PS", "login", @insertsuid, @passwdexp)
419   
420   
421   
422           end
423       end
424   
425       if @minpwdlen is not NULL
426       begin
427           select @attrib = 1,
428               @action = 1
429           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
430                   NULL, NULL, NULL, "login", @minpwdlen, NULL, NULL, NULL,
431                   NULL, @action) = 0
432           begin
433               /* 
434               ** 17267, "Incorrect 'minimum password length' attribute
435               ** specified. Login not created."
436               */
437               raiserror 17267, "minimum password length"
438               goto clean_all
439           end
440           else
441           begin
442               insert into master.dbo.sysattributes(class, attribute,
443                   object_type, object_cinfo, object, int_value)
444               values
445               (@passeclass, @attrib, "PS", "login", @insertsuid,
446                   @minpwdlen)
447   
448   
449   
450           end
451       end
452   
453   
454       if @maxfailedlogins is not NULL
455       begin
456           select @attrib = 2,
457               @action = 1
458           if attrib_valid(@passeclass, @attrib, "PS", @insertsuid,
459                   NULL, NULL, NULL, "login", @maxfailedlogins, NULL, NULL,
460                   NULL, NULL, @action) = 0
461           begin
462               /* 
463               ** 17267, "Incorrect 'maximum failed logins' specified.
464               ** Login not created."
465               */
466               raiserror 17267, "maximum failed logins"
467               goto clean_all
468           end
469           else
470           begin
471               insert into master.dbo.sysattributes(class, attribute,
472                   object_type, object_cinfo, object, int_value)
473               values
474               (@passeclass, @attrib, "PS", "login", @insertsuid,
475                   @maxfailedlogins)
476   
477   
478   
479           end
480       end
481   
482       /*
483       ** Check whether authentication mechanism specified is valid or not.
484       ** 'AUTH_DEFAULT' and 'AUTH_MASK' are new values added in spt_values
485       ** used to obtain value of default ('ANY') authmech or authentication
486       ** mask respectively. They are not valid names that the user can specify
487       ** as authentication mechanism.
488       */
489       select @authid = low, @config = number
490       from master.dbo.spt_values
491       where type = 'ua' and name = upper(@auth_mech) and
492           upper(@auth_mech) not in ('AUTH_DEFAULT', 'AUTH_MASK')
493   
494       if @@rowcount = 0
495       begin
496           /*
497           ** 19257, "The authentication mechanism '%1!' is not valid."
498           */
499           raiserror 19257, @auth_mech
500           goto clean_all
501       end
502   
503       /*
504       ** If authmech is 'ANY', then obtain the value of default authmech
505       ** 'ASE_DEFAULT' defined in spt_values.
506       */
507       if (upper(@auth_mech) = "ANY")
508       begin
509           select @authid = low from master.dbo.spt_values
510           where type = 'ua' and name = "AUTH_DEFAULT"
511       end
512   
513       /*
514       ** Check if the authentication method is enabled.
515       */
516       if (@config != 0) and not exists (select 1
517               from master.dbo.syscurconfigs a
518               where a.config = @config and a.value != 0)
519       begin
520           /*
521           ** 19259, "Warning. Authentication mechanism '%1!' is not enabled."
522           */
523           exec sp_getmessage 19259, @msg output
524           print @msg, @auth_mech
525       end
526   
527       /* Set status to LOGIN_LOCKED | Authentication mask */
528       select @status = 2 | @authid
529   
530       /*
531       **  Create the login.  Lock the account temporarily and
532       **  Put in a dont-care NULL as password.
533       */
534       insert into master.dbo.syslogins(suid, status, accdate, totcpu, totio,
535           spacelimit, timelimit, resultlimit,
536           dbname, name, password, language,
537           pwdate, audflags, fullname)
538       values (@insertsuid, @status, getdate(), 0, 0, 0, 0, 0,
539           @defdb, @loginame, NULL, @deflanguage,
540           getdate(), 0, @fullname)
541   
542   
543   
544   
545   
546       /*
547       **  Encrypt and store the input password
548       */
549       execute @returncode = sp_password NULL, @passwd, @loginame
550   
551   
552   
553       if (@returncode = 0)
554       begin
555           /*
556           ** Before we log our system procedure execution instance,
557           ** re-initialize the '@password' parameter to the encrypted form of
558           ** the password.  This prevents the password from being stored in
559           ** clear text in the transaction log as well as in the Replication
560           ** Server stable queues.
561           **
562           ** When the ASE RepAgent Thread sends the system procedure
563           ** execution instance to the Replication Server, the ASE RepAgent
564           ** will re-name the system procedure from 'sp_addlogin()' to
565           ** 'sp_addlogin_rep()'.  This will cause the Replication Server to
566           ** execute, at the target ASE, the system procedure
567           ** 'sp_addlogin_rep()' which knows how to properly process the
568           ** encrypted password.
569           */
570           select @passwd = password
571           from master.dbo.syslogins
572           where suid = @insertsuid
573   
574           /*
575           ** If the 'master' database is marked for replication, the T-SQL
576           ** built-in 'logexec()' will log for replication the execution
577           ** instance of this system procedure.  Otherwise, the T-SQL
578           ** built-in 'logexec()' is a no-op.
579           */
580           if (logexec(1) != 1)
581           begin
582               raiserror 17756, "sp_addlogin", "master"
583               select @returncode = 1
584           end
585       end
586   
587       if @returncode = 0
588       begin
589           /* UN-lock the account after successful update */
590           /* except in case of user sybmail a MAPI requirement. */
591           if (@loginame != "sybmail")
592           begin
593               execute @returncode = sp_locklogin @loginame, "unlock"
594   
595           end
596       end
597       else
598       begin
599           /*
600           ** Delete relevant syslogins and sysattribute login information
601           ** for this login, in order to backout.
602           */
603           delete from master.dbo.syslogins where name = @loginame
604           delete from master.dbo.sysattributes
605           where class = @passeclass AND object = @insertsuid
606               AND object_cinfo = "login"
607   
608   
609   
610       end
611   
612       if @returncode = 0
613       begin
614           /*
615           ** 17264, "New login created."
616           */
617           exec sp_getmessage 17264, @msg output
618           print @msg
619       end
620   
621   
622       close sync_cursor
623       deallocate cursor sync_cursor
624   
625       return (@returncode)
626   
627   clean_all:
628   
629       return (1)
630   


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) 376
 MTYP 4 Assignment type mismatch attribute: smallint = int 418
 MTYP 4 Assignment type mismatch class: smallint = int 418
 MTYP 4 Assignment type mismatch attribute: smallint = int 445
 MTYP 4 Assignment type mismatch class: smallint = int 445
 MTYP 4 Assignment type mismatch attribute: smallint = int 474
 MTYP 4 Assignment type mismatch class: smallint = int 474
 MTYP 4 Assignment type mismatch status: smallint = int 538
 MTYP 4 Assignment type mismatch dbname: sysname = varchar(255) 539
 MTYP 4 Assignment type mismatch language: varchar(30) = varchar(255) 539
 MTYP 4 Assignment type mismatch name: sysname = varchar(255) 539
 MTYP 4 Assignment type mismatch fullname: varchar(30) = varchar(255) 540
 MTYP 4 Assignment type mismatch @loginame: varchar(30) = varchar(255) 593
 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}
389
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
491
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
510
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 319
 QTYP 4 Comparison type mismatch smallint = int 319
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 518
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 605
 QTYP 4 Comparison type mismatch smallint = int 605
 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 534
 CUSU 3 Cursor updated through 'searched update': risk of halloween rows sync_cursor 603
 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 388
 MNER 3 No Error Check should check @@error after insert 415
 MNER 3 No Error Check should check @@error after insert 442
 MNER 3 No Error Check should check @@error after insert 471
 MNER 3 No Error Check should check return value of exec 523
 MNER 3 No Error Check should check @@error after insert 534
 MNER 3 No Error Check should check return value of exec 593
 MNER 3 No Error Check should check @@error after delete 603
 MNER 3 No Error Check should check @@error after delete 604
 MNER 3 No Error Check should check return value of exec 617
 MUCO 3 Useless Code Useless Brackets 154
 MUCO 3 Useless Code Useless Brackets 155
 MUCO 3 Useless Code Useless Brackets 169
 MUCO 3 Useless Code Useless Brackets 181
 MUCO 3 Useless Code Useless Brackets 184
 MUCO 3 Useless Code Useless Brackets 190
 MUCO 3 Useless Code Useless Brackets 206
 MUCO 3 Useless Code Useless Brackets 213
 MUCO 3 Useless Code Useless Brackets 214
 MUCO 3 Useless Code Useless Brackets 221
 MUCO 3 Useless Code Useless Brackets 240
 MUCO 3 Useless Code Useless Brackets 292
 MUCO 3 Useless Code Useless Brackets 307
 MUCO 3 Useless Code Useless Brackets 328
 MUCO 3 Useless Code Useless Brackets 350
 MUCO 3 Useless Code Useless Brackets 365
 MUCO 3 Useless Code Useless Brackets 377
 MUCO 3 Useless Code Useless Brackets 507
 MUCO 3 Useless Code Useless Brackets 553
 MUCO 3 Useless Code Useless Brackets 580
 MUCO 3 Useless Code Useless Brackets 591
 MUCO 3 Useless Code Useless Brackets 625
 MUCO 3 Useless Code Useless Brackets 629
 MUOT 3 Updates outside transaction 604
 QAFM 3 Var Assignment from potentially many rows 223
 QAFM 3 Var Assignment from potentially many rows 242
 QAFM 3 Var Assignment from potentially many rows 489
 QAFM 3 Var Assignment from potentially many rows 509
 QFID 3 Force index master..syslogins 285
 QISO 3 Set isolation level 175
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 415
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 442
 QIWC 3 Insert with not all columns specified missing 9 columns out of 15 471
 QIWC 3 Insert with not all columns specified missing 10 columns out of 25 534
 QPNC 3 No column in condition 492
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
224
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
243
 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}
319
 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}
605
 VNRD 3 Variable is not read @db_rep_level_all 143
 VNRD 3 Variable is not read @db_rep_level_l1 145
 VNRD 3 Variable is not read @curname 278
 VNRD 3 Variable is not read @passwd 570
 VUNU 3 Variable is not used @dummy 98
 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) 137
 MSUB 2 Subquery Marker 284
 MSUB 2 Subquery Marker 298
 MSUB 2 Subquery Marker 318
 MSUB 2 Subquery Marker 342
 MSUB 2 Subquery Marker 516
 MTR1 2 Metrics: Comments Ratio Comments: 56% 81
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 35 = 45dec - 12exi + 2 81
 MTR3 2 Metrics: Query Complexity Complexity: 196 81

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