DatabaseProcApplicationCreatedLinks
sybsystemprocssp_ijdbc_convert_datatype  31 Aug 14Defects Dependencies

1     
2     create procedure sp_ijdbc_convert_datatype(
3         @source int,
4         @destination int)
5     as
6     
7         if @@trancount = 0
8         begin
9             set chained off
10        end
11    
12        set transaction isolation level 1
13    
14        /* Make source non-negative */
15        select @source = @source + 7
16        /* Put the strange date numbers into this area between 0-19*/
17        if (@source > 90)
18            select @source = @source - 82
19    
20        /*Convert destination the same way*/
21        /* Put the strange date numbers into this area between 0-19*/
22        if (@destination > 90)
23            select @destination = @destination - 82
24    
25        /* Need 8 added instead of 7 because substring starts at 1 instead */
26        /* of 0 */
27        select @destination = @destination + 8
28    
29        /* Check the conversion. If the bit string in the table has a 1 
30        ** on the place's number of the destination's value we have to 
31        ** return true, else false
32        */
33    
34        delete #tmp_convert_datatype
35    
36        if ((select substring(conversion, @destination, 1)
37                    from master.dbo.spt_ijdbc_conversion
38                    where datatype = @source) = '1')
39    
40            insert #tmp_convert_datatype
41            select 1
42        else
43            insert #tmp_convert_datatype
44            select 0
45    
46    


exec sp_procxmode 'sp_ijdbc_convert_datatype', 'AnyMode'
go

Grant Execute on sp_ijdbc_convert_datatype to public
go
DEFECTS
 TNOI 4 Table with no index master..spt_ijdbc_conversion master..spt_ijdbc_conversion
 MGTP 3 Grant to public master..spt_ijdbc_conversion  
 MGTP 3 Grant to public sybsystemprocs..sp_ijdbc_convert_datatype  
 MNER 3 No Error Check should check @@error after delete 34
 MNER 3 No Error Check should check @@error after insert 40
 MNER 3 No Error Check should check @@error after insert 43
 MUCO 3 Useless Code Useless Brackets in create proc 2
 MUCO 3 Useless Code Useless Brackets 17
 MUCO 3 Useless Code Useless Brackets 22
 MUCO 3 Useless Code Useless Brackets 36
 QISO 3 Set isolation level 12
 MSUB 2 Subquery Marker 36
 MTR1 2 Metrics: Comments Ratio Comments: 32% 2
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 5 = 4dec - 1exi + 2 2
 MTR3 2 Metrics: Query Complexity Complexity: 23 2

DEPENDENCIES
PROCS AND TABLES USED
reads table master..spt_ijdbc_conversion (1)  
writes table tempdb..#tmp_convert_datatype (1)