DatabaseProcApplicationCreatedLinks
sybsystemprocssp_jdbc_getsupertypes  31 Aug 14Defects Dependencies

1     /** SECTION END: CLEANUP **/
2     
3     create procedure sp_jdbc_getsupertypes(
4         @catalog varchar(32) = NULL,
5         @schemaPattern varchar(32) = NULL,
6         @typeNamePattern varchar(255))
7     as
8         if (@catalog is null) or (@catalog = '')
9             select @catalog = db_name()
10    
11        if (@schemaPattern is null) or (@schemaPattern = '')
12            select @schemaPattern = '%'
13    
14        if (@typeNamePattern is null)
15        begin
16            raiserror 17208
17                'Null is not allowed for parameter TYPE NAME PATTERN'
18            return (1)
19        end
20    
21        select
22            TYPE_CAT = @catalog,
23            TYPE_SCHEM = convert(varchar, b.name),
24            TYPE_NAME = convert(varchar, t.name),
25            SUPERTYPE_CAT = @catalog,
26            SUPERTYPE_SCHEM = 'dbo',
27            SUPERTYPE_NAME = convert(varchar, p.name)
28    
29        from systypes t, sysusers b, systypes p
30        where t.uid = b.uid
31            and t.usertype >= 100
32            and t.type = p.type
33            and p.usertype = (select min(usertype) from systypes where type = t.type)
34            and b.name like @schemaPattern
35            and t.name like @typeNamePattern
36    


exec sp_procxmode 'sp_jdbc_getsupertypes', 'AnyMode'
go

Grant Execute on sp_jdbc_getsupertypes to public
go
RESULT SETS
sp_jdbc_getsupertypes_rset_001

DEFECTS
 QJWI 5 Join or Sarg Without Index 32
 QJWI 5 Join or Sarg Without Index 33
 MEST 4 Empty String will be replaced by Single Space 8
 MEST 4 Empty String will be replaced by Single Space 11
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 31
 MGTP 3 Grant to public sybsystemprocs..sp_jdbc_getsupertypes  
 MGTP 3 Grant to public sybsystemprocs..systypes  
 MGTP 3 Grant to public sybsystemprocs..sysusers  
 MUCO 3 Useless Code Useless Brackets in create proc 3
 MUCO 3 Useless Code Useless Brackets 14
 MUCO 3 Useless Code Useless Brackets 18
 QNAJ 3 Not using ANSI Inner Join 29
 QNUA 3 Should use Alias: Table sybsystemprocs..systypes 33
 MRST 2 Result Set Marker 21
 MSUC 2 Correlated Subquery Marker 33
 MTR1 2 Metrics: Comments Ratio Comments: 2% 3
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 5dec - 2exi + 2 3
 MTR3 2 Metrics: Query Complexity Complexity: 25 3
 PRED_QUERY_COLLECTION 2 {t=sybsystemprocs..systypes, t2=sybsystemprocs..systypes, u=sybsystemprocs..sysusers} 0 21
 PRED_QUERY_COLLECTION 2 {t=sybsystemprocs..systypes, t2=sybsystemprocs..systypes} 0 33

DEPENDENCIES
PROCS AND TABLES USED
reads table sybsystemprocs..systypes  
reads table sybsystemprocs..sysusers