Database | Proc | Application | Created | Links |
sybsystemprocs | sp_displayroles | 31 Aug 14 | Defects Dependencies |
1 2 /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */ 3 /* 5.0 1.0 06/10/96 sproc/src/displayroles */ 4 5 /* 6 ** Messages for "sp_displayroles" 18342 7 ** 18342, "Invalid name '%1!'. This role or user or login profile does not 8 ** exist." 9 ** 18343, "Invalid mode '%1!'. Mode should either be 'expand_up' or 10 ** 'expand_down'." 11 ** 18344, "The user name '%1!' should correspond to the current user or you 12 ** must possess System Security Officer (SSO) authorization to execute 13 ** '%2!' for another user." 14 ** 17020, "The specified login profile '%1!' must be associated with the current 15 ** user or you must possess System Security Officer (SSO) authorization." 16 ** 18674, "Cannot display role information for a login or login profile name." 17 ** 18675, "Password expiration interval: %1!" 18 ** 18676, "Password Expired: %1!" 19 ** 18677, "Minimum Password Length: %1!" 20 ** 18678, "Maximum failed logins: %1!" 21 ** 18679, "Current failed login attempts: %1!" 22 ** 19872, "Role locked by '%1!' by manually executing alter role '%2!' lock." 23 ** 19873, "Role locked by ASE due to failed role activation attempts 24 ** reaching 'max failed_logins' limit." 25 ** 19645, "Password column corrupted" 26 */ 27 28 create procedure sp_displayroles 29 @name varchar(30) = NULL, /* role name or login name 30 ** or login profile name 31 */ 32 @mode varchar(30) = NULL /* "expand_up" or "expand_down" */ 33 34 as 35 36 declare @grantee varchar(30) /* grantee name */ 37 declare @loginame varchar(30) /* login name */ 38 declare @hier_level int 39 declare @udr_class int /* UDR_CLASS value in sysattributes */ 40 declare @udr_role_hier int /* value of attribute in sysattributes 41 ** for rows corresponding to role 42 ** hierarchy 43 */ 44 declare @msg varchar(1024) /* message holder */ 45 declare @pwdate datetime /* last passwd set date */ 46 declare @status smallint /* value of status */ 47 declare @locked varchar(3) /* is the role locked? */ 48 declare @lockdate datetime /* value of lockdate */ 49 declare @locksuid int /* value of locksuid */ 50 declare @lockingloginname varchar(30) /* Login name of locksuid */ 51 declare @lockreason int /* value of lockreason */ 52 declare @reason varchar(30) /* reason of locking role */ 53 declare @passwdexp int /* value of passwd expiration */ 54 declare @minpwdlen int /* value of minimum passwd 55 ** length 56 */ 57 declare @pwdexpired varchar(3) /* has the login's password 58 ** expired? 59 */ 60 declare @maxfailedlogins int /* value of max failed logins */ 61 declare @currentfails int /* number of current failed 62 ** logins 63 */ 64 declare @srid int /* srid of the grantee */ 65 declare @passeclass int /* class number of PASSWD_SECURITY 66 ** class in sysattributes 67 */ 68 declare @local_msgbuf char(30) /* message holder */ 69 declare @suid int /* suid of specified login or 70 ** or login profile 71 */ 72 declare @user_lpid int /* associated login profile id of user 73 ** executing this procedure 74 */ 75 declare @lprofile int /* status bit value for login profile */ 76 declare @lprofile_def int /* status bit value for default 77 ** login profile 78 */ 79 declare @passwordprot tinyint /* Role password protected? */ 80 declare @vers tinyint /* Contains byte 2 of password column */ 81 declare @encralgo varchar(30) /* Contains type of encryption algorithm 82 ** information 83 */ 84 declare @def_lpid int /* default login profile id */ 85 declare @profilename varchar(30) /* login profile name */ 86 declare @lp_class int /* login profile class */ 87 declare @default_lp_attr int /* sysattributes.attribute for 88 ** 'default login profile' 89 */ 90 declare @lp_has_role int /* login profile has granted role(s) */ 91 92 /* 93 ** A @@trancount of 0 indicates no current transaction. 94 */ 95 if @@trancount = 0 96 begin 97 /* In chained mode, SQL Server implicitly executes a "begin 98 ** transaction" before the following statements: delete, fetch, 99 ** insert, open, select, and update. 100 */ 101 set chained off 102 end 103 104 /* Exclusive lock on objects being changed, held until transaction ends. No 105 ** shared locks 106 */ 107 set transaction isolation level 1 108 109 if (@name = 'help') 110 begin 111 print "sp_displayroles Usage: sp_displayroles [grantee_name [, mode]]" 112 print "grantee_name := login_name | role_name | login_profile_name" 113 print "mode := 'expand_up' | 'expand_down' | 'display_info'" 114 return (0) 115 end 116 117 select @udr_class = class 118 from master.dbo.sysattributes 119 where object_type = "UR" 120 121 select @lp_class = class 122 from master.dbo.sysattributes 123 where object_type = "LR" 124 125 select @udr_role_hier = 2 126 select @user_lpid = - 1 /* Login profile is not associated */ 127 select @lprofile = 512 /* bit value 0x0200 */ 128 select @lprofile_def = 1024 /* bit value 0x0400 */ 129 select @passwordprot = 0 /* Role is not password protected. */ 130 select @def_lpid = null 131 select @profilename = null 132 select @default_lp_attr = 4 /* sysattributes.attribute for 133 ** 'default login profile' 134 */ 135 select @lp_has_role = 0 136 137 /* Convert the first and last args to lower case with no leading/trailing 138 ** blanks. 139 */ 140 if @mode is not NULL 141 select @mode = lower(ltrim(rtrim(@mode))) 142 143 if @name is NULL 144 begin 145 if (@mode = "display_info") 146 begin 147 /* 148 ** 18674, "Cannot display role information 149 ** for a login or login profile name." 150 */ 151 raiserror 18674 152 return (1) 153 end 154 else 155 begin 156 select @name = suser_name() 157 select @loginame = @name 158 select @grantee = @name 159 select @status = status, @suid = suid 160 from master.dbo.syslogins 161 where name = @name 162 end 163 end 164 else 165 begin 166 /* check if name is a valid loginname or login profile name */ 167 if exists (select 1 from master.dbo.syslogins 168 where name = @name) 169 begin 170 if (@mode = "display_info") 171 begin 172 /* 173 ** 18674, "Cannot display role information 174 ** for a login or login profile name." 175 */ 176 raiserror 18674 177 return (1) 178 end 179 else 180 begin 181 select @grantee = @name 182 select @loginame = @name 183 select @status = status, @suid = suid 184 from master.dbo.syslogins 185 where name = @name 186 end 187 188 end 189 else 190 begin 191 if exists (select * from master.dbo.syssrvroles 192 where name = @name) 193 begin 194 select @grantee = @name 195 select @loginame = NULL 196 end 197 else 198 begin 199 /* 18342, "Invalid name '%1!'. This role or user or 200 ** login profile does not exist." 201 */ 202 raiserror 18342, @name 203 return (1) 204 end 205 end 206 end 207 208 if @mode is NULL 209 select @mode = "direct" 210 211 /* verify mode is set to "expand_up" or "expand_down" or "display_info" */ 212 else if (@mode != "expand_down" and @mode != "expand_up" and 213 @mode != "display_info") 214 begin 215 /* 18343, "Invalid mode '%1!'. Mode should either be 'expand_up' 216 ** or 'expand_down' or 'display_info'." 217 */ 218 raiserror 18343, @mode 219 return (1) 220 end 221 222 /* Display role related info, that is requested & exit */ 223 if (@mode = "display_info") 224 begin 225 /* NOTE: For all the password control related 226 ** information printed below, a check is first 227 ** made if the specified role has a value 228 ** for the attribute in sysattribute. If there 229 ** is no configured value, then the systemwide 230 ** default is picked up from sysconfigures 231 */ 232 select @srid = srid from master.dbo.syssrvroles 233 where name = @grantee 234 235 /* Print the role name */ 236 print "Role name : %1!", @grantee 237 238 /* Print the role locked information */ 239 select @status = status, 240 @lockdate = lockdate, 241 @locksuid = locksuid, 242 @lockreason = lockreason 243 from master.dbo.syssrvroles 244 where name = @grantee 245 if (@status = 2) 246 begin 247 /* Role is locked */ 248 select @locked = "YES" 249 print "Locked : %1!", @locked 250 print " Date when locked : %1!", @lockdate 251 252 if (@lockreason = 1) 253 begin 254 /* 255 ** 19872, "Role locked by '%1!' by manually executing 256 ** alter role '%2!' lock." 257 */ 258 exec sp_getmessage 19872, @msg output 259 select @msg = " Reason : " + @msg 260 select @lockingloginname = suser_name(@locksuid) 261 print @msg, @lockingloginname, @grantee 262 end 263 else if (@lockreason = 2) 264 begin 265 /* 266 ** 19873, "Role locked by ASE due to failed role 267 ** activation attempts reaching 268 ** 'max failed_logins' limit." 269 */ 270 exec sp_getmessage 19873, @msg output 271 select @msg = " Reason : " + @msg 272 print @msg 273 select @lockingloginname = suser_name(@locksuid) 274 end 275 276 print " Locking suid : %1!", @lockingloginname 277 end 278 else 279 begin 280 /* Role is not locked */ 281 select @locked = "NO" 282 print "Locked : %1!", @locked 283 end 284 285 /* Date of last password change */ 286 select @pwdate = pwdate from master.dbo.syssrvroles 287 where name = @grantee 288 print "Date of Last Password change : %1!", @pwdate 289 290 /* set the value of PASSWD_SECURITY class 291 */ 292 select @passeclass = class from master.dbo.sysattributes where 293 object_type = "PS" 294 295 /* Password expiration interval */ 296 select @passwdexp = int_value 297 from master.dbo.sysattributes 298 where class = @passeclass AND 299 attribute = 0 AND 300 object = @srid AND object_cinfo = "role" 301 302 if (@passwdexp is NULL) 303 begin 304 select @passwdexp = value 305 from master.dbo.sysconfigures 306 where name = "systemwide password expiration" 307 end 308 309 /* 310 ** 18675, "Password expiration interval: %1!" 311 */ 312 exec sp_getmessage 18675, @msg output 313 select @local_msgbuf = convert(char(10), @passwdexp) 314 print @msg, @local_msgbuf 315 316 317 /* Has the role's password expired?? */ 318 if (@passwdexp = 0) 319 begin 320 select @pwdexpired = "NO" 321 end 322 else 323 if (datediff(dd, @pwdate, getdate()) > @passwdexp) 324 select @pwdexpired = "YES" 325 else 326 select @pwdexpired = "NO" 327 328 /* 329 ** 18676, "Password Expired: %1!" 330 */ 331 exec sp_getmessage 18676, @msg output 332 select @local_msgbuf = upper(@pwdexpired) 333 print @msg, @local_msgbuf 334 335 /* Minimum password length */ 336 select @minpwdlen = int_value 337 from master.dbo.sysattributes 338 where class = @passeclass AND 339 attribute = 1 AND 340 object = @srid AND object_cinfo = "role" 341 342 if (@minpwdlen is NULL) 343 begin 344 select @minpwdlen = value 345 from master.dbo.sysconfigures 346 where name = "minimum password length" 347 end 348 349 /* 350 ** 18677, "Minimum Password Length: %1!" 351 */ 352 exec sp_getmessage 18677, @msg output 353 select @local_msgbuf = convert(char(10), @minpwdlen) 354 print @msg, @local_msgbuf 355 356 357 /* Maximum failed logins */ 358 select @maxfailedlogins = int_value 359 from master.dbo.sysattributes 360 where class = @passeclass AND 361 attribute = 2 AND object = @srid 362 AND object_cinfo = "role" 363 364 if (@maxfailedlogins is NULL) 365 begin 366 select @maxfailedlogins = value 367 from master.dbo.sysconfigures 368 where name = "maximum failed logins" 369 end 370 371 /* 372 ** 18678, "Maximum failed logins: %1!" 373 */ 374 exec sp_getmessage 18678, @msg output 375 select @local_msgbuf = convert(char(10), @maxfailedlogins) 376 print @msg, @local_msgbuf 377 378 /* Current failed logins count */ 379 select @currentfails = logincount 380 from master.dbo.syssrvroles 381 where srid = @srid 382 383 /* 384 ** 18679, "Current failed login attempts: %1!" 385 */ 386 exec sp_getmessage 18679, @msg output 387 select @local_msgbuf = convert(char(10), @currentfails) 388 print @msg, @local_msgbuf 389 390 /* 391 ** Select password encryption algorithm information, 392 ** if role is password protected. 393 */ 394 select @passwordprot = 1, @vers = substring(password, 2, 1) 395 from master.dbo.syssrvroles 396 where name = @name and password != NULL 397 if (@passwordprot = 1) 398 begin 399 /* Values 1 to 5 and 7 are valid for @vers field */ 400 if @vers <= 5 and @vers >= 1 401 begin 402 select @encralgo = "SYB-PROP" 403 end 404 else if @vers = 7 405 begin 406 select @encralgo = "SHA-256" 407 end 408 else 409 begin 410 /* 411 ** 19645, "Password column corrupted" 412 */ 413 exec sp_getmessage 19645, @msg output 414 select @encralgo = @msg 415 end 416 select @msg = "Password encryption version: %1!" 417 print @msg, @encralgo 418 end 419 420 return (0) 421 end 422 else 423 if (@mode = "expand_up") 424 select @hier_level = 0 425 else 426 select @hier_level = 1 427 428 /* create a temporary table to hold the intermediate result of expansion */ 429 430 create table #intermediate_roleset 431 (rolename varchar(30) not null, 432 parentrolename varchar(30) null, 433 role_level smallint null, 434 grantee varchar(30) null) 435 436 if (@grantee = @loginame) 437 begin 438 /* Check that user has appropriate permissions */ 439 440 /* grantee is a login profile */ 441 if ((@status & @lprofile) = @lprofile) 442 begin 443 /* Get the associated login profile id for this user */ 444 select @user_lpid = lpid from master.dbo.syslogins 445 where name = suser_name() 446 447 /* 448 ** No permission error if any of the following: 449 ** 1) specified login profile is associated to this user 450 ** 2) specified login profile is default login profile and 451 ** some login profile is applicable to this user (i.e. 452 ** associated login profile id is not set to -1 (ignore)) 453 ** 3) SSO role is enabled for this user 454 ** 4) MANAGE_ANY_LOGIN_PROFILE previlege is granted for this user 455 ** RESOLVE: 456 ** MANAGE_ANY_LOGIN_PROFILE previlege is yet not defined 457 ** in asebharani. This is part of Granular Permissions 458 ** project. 459 */ 460 if (not ((@user_lpid = @suid) 461 or ((@user_lpid != - 1) 462 and ((@status & @lprofile_def) = @lprofile_def)) 463 or (charindex("sso_role", show_role()) != 0))) 464 begin 465 /* 17020, "The specified login profile '%1!' must be 466 ** associated with the current user or you must possess 467 ** System Security Officer (SSO) authorization." 468 */ 469 raiserror 17020, @name 470 return (1) 471 end 472 end 473 /* grantee is a login */ 474 else if (@name != suser_name()) 475 begin 476 /* make sure that the login has SSO role enabled */ 477 if (charindex("sso_role", show_role()) = 0) 478 begin 479 /* 18344, "The user name '%1!' should correspond to 480 ** the current user or you must possess System 481 ** Security Officer (SSO) authorization to execute 482 ** '%2!' for another user." 483 */ 484 raiserror 18344, @name, "sp_displayroles" 485 return (1) 486 end 487 end 488 489 /* select all names from syssrvroles for this user/login profile and 490 ** insert into #intermediate_roleset 491 */ 492 insert into #intermediate_roleset(rolename, role_level, grantee) 493 select r.name, @hier_level, @grantee 494 from master.dbo.sysloginroles l, 495 master.dbo.syssrvroles r 496 where l.srid = r.srid 497 and l.suid = @suid 498 499 /* for loginname */ 500 if (((@status & @lprofile) != @lprofile) and @mode != "expand_up") 501 begin 502 /* Get the associated login profile id for this user */ 503 select @user_lpid = lpid from master.dbo.syslogins 504 where name = @grantee 505 if (@user_lpid is NULL) 506 begin 507 /* default login profile is applicable */ 508 select @def_lpid = object 509 from master.dbo.sysattributes 510 where class = @lp_class and attribute = @default_lp_attr 511 512 if (@def_lpid is not null) 513 begin 514 select @profilename = name 515 from master.dbo.syslogins 516 where suid = @def_lpid 517 518 insert into #intermediate_roleset(rolename, 519 role_level, grantee) 520 select r.name, @hier_level, 521 @profilename 522 from master.dbo.sysloginroles l, 523 master.dbo.syssrvroles r 524 where l.srid = r.srid 525 and l.suid = @def_lpid 526 select @lp_has_role = @@rowcount 527 end 528 end 529 else if (@user_lpid != - 1) 530 begin 531 /* login profile is associated with this login */ 532 select @profilename = name from master.dbo.syslogins 533 where suid = @user_lpid 534 insert into #intermediate_roleset(rolename, 535 role_level, grantee) 536 select r.name, @hier_level, @profilename 537 from master.dbo.sysloginroles l, 538 master.dbo.syssrvroles r 539 where l.srid = r.srid 540 and l.suid = @user_lpid 541 select @lp_has_role = @@rowcount 542 end 543 /* else login profile is ignored for this login */ 544 end 545 end 546 547 else 548 begin 549 /* It is for a role. */ 550 551 if (@mode != "expand_up") 552 begin 553 /* select all rolenames from sysattributes 554 ** which are directly contained by this role and insert into 555 ** #intermediate_roleset 556 */ 557 558 insert into #intermediate_roleset(rolename, parentrolename, 559 role_level) 560 select role_name(object_info1), @grantee, @hier_level 561 from master.dbo.sysattributes 562 where object = role_id(@grantee) 563 and class = @udr_class 564 and attribute = @udr_role_hier 565 end 566 567 else 568 begin 569 /* select all rolenames from sysattributes 570 ** which are parents of this role and insert into 571 ** #intermediate_roleset 572 */ 573 insert into #intermediate_roleset(rolename, parentrolename, 574 role_level) 575 select @grantee, role_name(object), @hier_level 576 from master.dbo.sysattributes 577 where object_info1 = role_id(@grantee) 578 and class = @udr_class 579 and attribute = @udr_role_hier 580 581 end 582 end 583 584 /* If mode is 'direct' then display only directly granted roles to 585 ** role_name that was specified. 586 */ 587 if (@mode = "direct") 588 begin 589 /* 590 ** Display the rows from #intermediate_roleset and return. 591 ** 'Grantee' column is only displayed when a login has associated 592 ** login profile or default login profile is applicable and 593 ** roles are granted to it. 594 */ 595 if (@lp_has_role = 0) 596 begin 597 select "Role Name" = rolename 598 from #intermediate_roleset 599 end 600 else 601 begin 602 select "Role Name" = rolename, 603 "Grantee" = grantee 604 from #intermediate_roleset 605 end 606 607 return (0) 608 end 609 610 /* create two more temp tables, #cumulative_role_set and #temp_role_set */ 611 612 create table #cumulative_role_set 613 (rolename varchar(30) not null, 614 parentrolename varchar(30) null, 615 role_level smallint null, 616 grantee varchar(30) null) 617 618 create table #temp_role_set 619 (rolename varchar(30) not null, 620 parentrolename varchar(30) null, 621 role_level smallint null, 622 grantee varchar(30) null) 623 624 /* 625 ** For the while loop below, 626 ** the start condition is: 627 ** #cumulative_role_set contains nothing 628 ** #intermediate_roleset contains the base set of roles 629 ** #temp_roleset contains nothing 630 */ 631 632 while exists (select * from #intermediate_roleset) 633 begin 634 if (@mode = "expand_down") 635 begin 636 select @hier_level = @hier_level + 1 637 638 /* insert into #temp_role_set(role_level, select role1, role2 639 ** from sysattributes where row is of type 'role1 contains 640 ** role2' and role1 is in #intermediate_roleset) 641 */ 642 643 insert into #temp_role_set(rolename, parentrolename, role_level) 644 select role_name(object_info1), rolename, @hier_level 645 from master.dbo.sysattributes, #intermediate_roleset 646 where object = role_id(rolename) 647 and class = @udr_class 648 and attribute = @udr_role_hier 649 end 650 651 else 652 begin 653 select @hier_level = @hier_level - 1 654 655 /* insert into #temp_role_set(role_level, select role1, role2 656 ** from sysattributes where row is of type 'role1 is contained 657 ** by role2' and role1 is in #intermediate_roleset) 658 */ 659 660 insert into #temp_role_set(rolename, parentrolename, role_level) 661 select parentrolename, role_name(object), @hier_level 662 from master.dbo.sysattributes, #intermediate_roleset 663 where object_info1 = role_id(parentrolename) 664 and class = @udr_class 665 and attribute = @udr_role_hier 666 end /* Adaptive Server has expanded all '*' elements in the following statement */ 667 668 669 /* copy all rows from #intermediate_roleset into #cumulative_role_set */ 670 insert into #cumulative_role_set 671 select #intermediate_roleset.rolename, #intermediate_roleset.parentrolename, #intermediate_roleset.role_level, #intermediate_roleset.grantee 672 from #intermediate_roleset 673 where rolename not in (select rolename from #cumulative_role_set) 674 or parentrolename not in (select parentrolename 675 from #cumulative_role_set 676 where parentrolename is not null) 677 678 /* delete all rows from #intermediate_roleset */ 679 delete from #intermediate_roleset 680 681 /* copy all rows from #temp_role_set into #intermediate_roleset */ 682 /* Adaptive Server has expanded all '*' elements in the following statement */ insert into #intermediate_roleset 683 select #temp_role_set.rolename, #temp_role_set.parentrolename, #temp_role_set.role_level, #temp_role_set.grantee 684 from #temp_role_set 685 686 /* delete all rows from #temp_roleset */ 687 delete from #temp_role_set 688 end 689 690 /* select all rows from #cumulative_role_set and display it */ 691 if (@lp_has_role = 0) 692 begin 693 select distinct "Role Name" = rolename, 694 "Parent Role Name" = parentrolename, 695 "Level" = role_level 696 from #cumulative_role_set 697 order by role_level 698 end 699 else 700 begin 701 select distinct "Role Name" = rolename, 702 "Parent Role Name" = parentrolename, 703 "Level" = role_level, 704 "Grantee" = grantee 705 from #cumulative_role_set 706 order by role_level 707 end 708 709 return (0) 710
exec sp_procxmode 'sp_displayroles', 'AnyMode' go Grant Execute on sp_displayroles to public go
RESULT SETS | |
sp_displayroles_rset_004 | |
sp_displayroles_rset_003 | |
sp_displayroles_rset_002 | |
sp_displayroles_rset_001 |
DEFECTS | |
MINU 4 Unique Index with nullable columns master..sysattributes | master..sysattributes |
MINU 4 Unique Index with nullable columns master..sysconfigures | master..sysconfigures |
MTYP 4 Assignment type mismatch @encralgo: varchar(30) = varchar(1024) | 414 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 493 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 520 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 536 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 560 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 575 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 644 |
MTYP 4 Assignment type mismatch role_level: smallint = int | 661 |
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} | 119 |
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} | 123 |
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} | 293 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 298 |
QTYP 4 Comparison type mismatch smallint = int | 298 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 299 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 338 |
QTYP 4 Comparison type mismatch smallint = int | 338 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 339 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 360 |
QTYP 4 Comparison type mismatch smallint = int | 360 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 361 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 510 |
QTYP 4 Comparison type mismatch smallint = int | 510 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 563 |
QTYP 4 Comparison type mismatch smallint = int | 563 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 564 |
QTYP 4 Comparison type mismatch smallint = int | 564 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 578 |
QTYP 4 Comparison type mismatch smallint = int | 578 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 579 |
QTYP 4 Comparison type mismatch smallint = int | 579 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 647 |
QTYP 4 Comparison type mismatch smallint = int | 647 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 648 |
QTYP 4 Comparison type mismatch smallint = int | 648 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 664 |
QTYP 4 Comparison type mismatch smallint = int | 664 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 665 |
QTYP 4 Comparison type mismatch smallint = int | 665 |
TNOU 4 Table with no unique index master..sysloginroles | master..sysloginroles |
MGTP 3 Grant to public master..sysattributes | |
MGTP 3 Grant to public master..sysconfigures | |
MGTP 3 Grant to public master..syslogins | |
MGTP 3 Grant to public master..syssrvroles | |
MGTP 3 Grant to public sybsystemprocs..sp_displayroles | |
MNAC 3 Not using ANSI 'is null' | 396 |
MNER 3 No Error Check should check return value of exec | 258 |
MNER 3 No Error Check should check return value of exec | 270 |
MNER 3 No Error Check should check return value of exec | 312 |
MNER 3 No Error Check should check return value of exec | 331 |
MNER 3 No Error Check should check return value of exec | 352 |
MNER 3 No Error Check should check return value of exec | 374 |
MNER 3 No Error Check should check return value of exec | 386 |
MNER 3 No Error Check should check return value of exec | 413 |
MNER 3 No Error Check should check @@error after insert | 492 |
MNER 3 No Error Check should check @@error after insert | 518 |
MNER 3 No Error Check should check @@error after insert | 534 |
MNER 3 No Error Check should check @@error after insert | 558 |
MNER 3 No Error Check should check @@error after insert | 573 |
MNER 3 No Error Check should check @@error after insert | 643 |
MNER 3 No Error Check should check @@error after insert | 660 |
MNER 3 No Error Check should check @@error after insert | 670 |
MNER 3 No Error Check should check @@error after delete | 679 |
MNER 3 No Error Check should check @@error after insert | 682 |
MNER 3 No Error Check should check @@error after delete | 687 |
MUCO 3 Useless Code Useless Brackets | 109 |
MUCO 3 Useless Code Useless Brackets | 114 |
MUCO 3 Useless Code Useless Brackets | 145 |
MUCO 3 Useless Code Useless Brackets | 152 |
MUCO 3 Useless Code Useless Brackets | 170 |
MUCO 3 Useless Code Useless Brackets | 177 |
MUCO 3 Useless Code Useless Brackets | 203 |
MUCO 3 Useless Code Useless Brackets | 212 |
MUCO 3 Useless Code Useless Brackets | 219 |
MUCO 3 Useless Code Useless Brackets | 223 |
MUCO 3 Useless Code Useless Brackets | 245 |
MUCO 3 Useless Code Useless Brackets | 252 |
MUCO 3 Useless Code Useless Brackets | 263 |
MUCO 3 Useless Code Useless Brackets | 302 |
MUCO 3 Useless Code Useless Brackets | 318 |
MUCO 3 Useless Code Useless Brackets | 323 |
MUCO 3 Useless Code Useless Brackets | 342 |
MUCO 3 Useless Code Useless Brackets | 364 |
MUCO 3 Useless Code Useless Brackets | 397 |
MUCO 3 Useless Code Useless Brackets | 420 |
MUCO 3 Useless Code Useless Brackets | 423 |
MUCO 3 Useless Code Useless Brackets | 436 |
MUCO 3 Useless Code Useless Brackets | 441 |
MUCO 3 Useless Code Useless Brackets | 460 |
MUCO 3 Useless Code Useless Brackets | 470 |
MUCO 3 Useless Code Useless Brackets | 474 |
MUCO 3 Useless Code Useless Brackets | 477 |
MUCO 3 Useless Code Useless Brackets | 485 |
MUCO 3 Useless Code Useless Brackets | 500 |
MUCO 3 Useless Code Useless Brackets | 505 |
MUCO 3 Useless Code Useless Brackets | 512 |
MUCO 3 Useless Code Useless Brackets | 529 |
MUCO 3 Useless Code Useless Brackets | 551 |
MUCO 3 Useless Code Useless Brackets | 587 |
MUCO 3 Useless Code Useless Brackets | 595 |
MUCO 3 Useless Code Useless Brackets | 607 |
MUCO 3 Useless Code Useless Brackets | 634 |
MUCO 3 Useless Code Useless Brackets | 691 |
MUCO 3 Useless Code Useless Brackets | 709 |
QAFM 3 Var Assignment from potentially many rows | 117 |
QAFM 3 Var Assignment from potentially many rows | 121 |
QAFM 3 Var Assignment from potentially many rows | 232 |
QAFM 3 Var Assignment from potentially many rows | 239 |
QAFM 3 Var Assignment from potentially many rows | 286 |
QAFM 3 Var Assignment from potentially many rows | 292 |
QAFM 3 Var Assignment from potentially many rows | 296 |
QAFM 3 Var Assignment from potentially many rows | 304 |
QAFM 3 Var Assignment from potentially many rows | 336 |
QAFM 3 Var Assignment from potentially many rows | 344 |
QAFM 3 Var Assignment from potentially many rows | 358 |
QAFM 3 Var Assignment from potentially many rows | 366 |
QAFM 3 Var Assignment from potentially many rows | 394 |
QAFM 3 Var Assignment from potentially many rows | 508 |
QCRS 3 Conditional Result Set | 597 |
QCRS 3 Conditional Result Set | 602 |
QCRS 3 Conditional Result Set | 693 |
QCRS 3 Conditional Result Set | 701 |
QISO 3 Set isolation level | 107 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 492 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 518 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 534 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 558 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 573 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 643 |
QIWC 3 Insert with not all columns specified missing 1 columns out of 4 | 660 |
QJWT 3 Join or Sarg Without Index on temp table | 646 |
QJWT 3 Join or Sarg Without Index on temp table | 663 |
QJWT 3 Join or Sarg Without Index on temp table | 673 |
QJWT 3 Join or Sarg Without Index on temp table | 674 |
QNAJ 3 Not using ANSI Inner Join | 494 |
QNAJ 3 Not using ANSI Inner Join | 522 |
QNAJ 3 Not using ANSI Inner Join | 537 |
QNAJ 3 Not using ANSI Inner Join | 645 |
QNAJ 3 Not using ANSI Inner Join | 662 |
QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes | 644 |
QNUA 3 Should use Alias: Column rolename should use alias #intermediate_roleset | 644 |
QNUA 3 Should use Alias: Table #intermediate_roleset | 645 |
QNUA 3 Should use Alias: Table master..sysattributes | 645 |
QNUA 3 Should use Alias: Column object should use alias sysattributes | 646 |
QNUA 3 Should use Alias: Column rolename should use alias #intermediate_roleset | 646 |
QNUA 3 Should use Alias: Column class should use alias sysattributes | 647 |
QNUA 3 Should use Alias: Column attribute should use alias sysattributes | 648 |
QNUA 3 Should use Alias: Column object should use alias sysattributes | 661 |
QNUA 3 Should use Alias: Column parentrolename should use alias #intermediate_roleset | 661 |
QNUA 3 Should use Alias: Table #intermediate_roleset | 662 |
QNUA 3 Should use Alias: Table master..sysattributes | 662 |
QNUA 3 Should use Alias: Column object_info1 should use alias sysattributes | 663 |
QNUA 3 Should use Alias: Column parentrolename should use alias #intermediate_roleset | 663 |
QNUA 3 Should use Alias: Column class should use alias sysattributes | 664 |
QNUA 3 Should use Alias: Column attribute should use alias sysattributes | 665 |
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, object_cinfo, attribute, class} | 298 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered (name, parent, config) Intersection: {name} | 306 |
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, object_cinfo, attribute, class} | 338 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered (name, parent, config) Intersection: {name} | 346 |
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, object_cinfo, attribute, class} | 360 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysconfigures.csysconfigures unique clustered (name, parent, config) Intersection: {name} | 368 |
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} | 510 |
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, attribute} | 562 |
QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysattributes.csysattributes unique clustered (class, attribute, object_type, object, object_info1, object_info2, object_info3, object_cinfo) Intersection: {class, object_info1, attribute} | 577 |
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} | 647 |
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} | 664 |
QSWV 3 Sarg with variable @suid, Candidate Index: sysloginroles.csysloginroles clustered(suid) F | 497 |
QSWV 3 Sarg with variable @def_lpid, Candidate Index: sysloginroles.csysloginroles clustered(suid) F | 525 |
QSWV 3 Sarg with variable @user_lpid, Candidate Index: sysloginroles.csysloginroles clustered(suid) F | 540 |
QTLO 3 Top-Level OR | 673 |
VUNU 3 Variable is not used @reason | 52 |
MRST 2 Result Set Marker | 597 |
MRST 2 Result Set Marker | 602 |
MRST 2 Result Set Marker | 693 |
MRST 2 Result Set Marker | 701 |
MSUB 2 Subquery Marker | 167 |
MSUB 2 Subquery Marker | 191 |
MSUB 2 Subquery Marker | 674 |
MTR1 2 Metrics: Comments Ratio Comments: 39% | 28 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 48 = 56dec - 10exi + 2 | 28 |
MTR3 2 Metrics: Query Complexity Complexity: 355 | 28 |
PRED_QUERY_COLLECTION 2 {l=master..sysloginroles, s=master..syssrvroles} 0 | 493 |
PRED_QUERY_COLLECTION 2 {l=master..sysloginroles, s=master..syssrvroles} 0 | 520 |
PRED_QUERY_COLLECTION 2 {l=master..sysloginroles, s=master..syssrvroles} 0 | 536 |
DEPENDENCIES |
PROCS AND TABLES USED reads table master..syslogins (1) read_writes table tempdb..#temp_role_set (1) read_writes table tempdb..#cumulative_role_set (1) read_writes table tempdb..#intermediate_roleset (1) reads table master..sysconfigures (1) reads table master..sysattributes (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..syssrvroles (1) reads table master..sysloginroles (1) |