Database | Proc | Application | Created | Links |
sybsystemprocs | sp_client_addr | 31 Aug 14 | Defects Dependencies |
1 2 3 /* 4 ** sp_client_addr 5 ** 6 ** Stored procedure to pull client ip addresses from sysprocesses table 7 ** Requires ASE 12.5 or later 8 ** 9 ** messages raised: 10 ** 18934, "spid not found" 11 */ 12 13 create procedure sp_client_addr @spid int = NULL as 14 15 declare @count int 16 17 if @@trancount = 0 18 begin 19 set chained off 20 end 21 22 set transaction isolation level 1 23 24 if @spid is not NULL 25 begin 26 select @count = count(*) from master..sysprocesses where spid = @spid 27 if (@count = 0) 28 begin 29 /* 30 ** 18934, "spid not found" 31 */ 32 raiserror 18934 33 return (1) 34 end 35 36 select spid, hostname, ipaddr from master..sysprocesses where spid = @spid 37 end 38 39 else 40 begin 41 select spid, hostname, ipaddr from master..sysprocesses where ipaddr is not NULL 42 end 43 44 return (0) 45 46
exec sp_procxmode 'sp_client_addr', 'AnyMode' go Grant Execute on sp_client_addr to public go
RESULT SETS | |
sp_client_addr_rset_002 | |
sp_client_addr_rset_001 |
DEFECTS | |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 26 |
QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int | 36 |
TNOI 4 Table with no index master..sysprocesses | master..sysprocesses |
MGTP 3 Grant to public master..sysprocesses | |
MGTP 3 Grant to public sybsystemprocs..sp_client_addr | |
MUCO 3 Useless Code Useless Brackets | 27 |
MUCO 3 Useless Code Useless Brackets | 33 |
MUCO 3 Useless Code Useless Brackets | 44 |
QCRS 3 Conditional Result Set | 36 |
QCRS 3 Conditional Result Set | 41 |
QISO 3 Set isolation level | 22 |
MRST 2 Result Set Marker | 36 |
MRST 2 Result Set Marker | 41 |
MTR1 2 Metrics: Comments Ratio Comments: 30% | 13 |
MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 3dec - 2exi + 2 | 13 |
MTR3 2 Metrics: Query Complexity Complexity: 22 | 13 |
DEPENDENCIES |
PROCS AND TABLES USED reads table master..sysprocesses (1) |