DatabaseProcApplicationCreatedLinks
sybsystemprocssp_drv_gettypes  31 Aug 14Defects Dependencies

1     
2     create procedure sp_drv_gettypes(@sstype int = 0, @usertype int = 0)
3     as
4         declare @cmd varchar(500)
5     
6         select @cmd = ' select name=case 
7     	when b.usertype=18 then ''sysname'' 
8     	when b.usertype=25 then ''nvarchar'' 
9     	when b.usertype=42 then ''longsysname'' 
10    	when b.usertype=80 then ''timestamp'' 
11    	when b.usertype=24 then ''nchar'' 
12    	when a.ss_dtype=111 then ''datetimn'' 
13    	when a.ss_dtype=109 then ''floatn'' 
14    	else local_type_name end,
15    	a.ss_dtype,
16    	b.usertype 
17    	from sybsystemprocs.dbo.spt_datatype_info a,
18    	systypes b 
19    	where a.ss_dtype=b.type  '
20    
21        if @sstype > 0 and @usertype > 0
22        begin
23            select @cmd = @cmd + ' and a.ss_dtype=' + convert(varchar(10), @sstype) + '  and b.usertype=' + convert(varchar(10), @usertype)
24    
25        end
26        else if @sstype = 0 and @usertype = 0
27        begin
28            select @cmd = @cmd
29        end
30        else if @sstype = 0
31        begin
32            select @cmd = @cmd + '  and b.usertype=' + convert(varchar(10), @usertype)
33    
34        end
35        else if @usertype = 0
36        begin
37            select @cmd = @cmd + ' and a.ss_dtype=' + convert(varchar(10), @sstype)
38        end
39    
40        --select @cmd
41        execute (@cmd)
42    
43    


exec sp_procxmode 'sp_drv_gettypes', 'AnyMode'
go

Grant Execute on sp_drv_gettypes to public
go
DEFECTS
 MDYN 3 Proc uses Dynamic SQL but is not flagged with Dynamic Ownership Chain 2
 MGTP 3 Grant to public sybsystemprocs..sp_drv_gettypes  
 MUCO 3 Useless Code Useless Brackets in create proc 2
 MDYS 2 Dynamic SQL Marker 41
 MTR1 2 Metrics: Comments Ratio Comments: 1% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 7 = 6dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 18 2

DEPENDENCIES