DatabaseProcApplicationCreatedLinks
sybsystemprocssp_ijdbc_default_charset  31 Aug 14Defects Dependencies

1     
2     /*
3     **  sp_ijdbc_default_charset
4     */
5     
6     /* 
7     ** obtain the SQL server default charset
8     */
9     
10    
11    /*
12    **  create a procedure that will query the datasource
13    **  specific syscharset, and sysconfigures tables, and do a join to 
14    **  determine what is the correct charset that has been set as a default
15    **  on the server.
16    */
17    
18    create procedure sp_ijdbc_default_charset
19    as
20    
21        delete #tmp_default_charset
22    
23        if @@trancount = 0
24        begin
25            set chained off
26        end
27    
28        set transaction isolation level 1
29    
30        insert #tmp_default_charset
31        select name
32    
33        from master.dbo.syscharsets
34        where ((select value from master.dbo.sysconfigures
35                    where config = 131) /* default charset id */
36                = master.dbo.syscharsets.id)
37    


exec sp_procxmode 'sp_ijdbc_default_charset', 'AnyMode'
go

Grant Execute on sp_ijdbc_default_charset to public
go
DEFECTS
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 34
 QTYP 4 Comparison type mismatch tinyint = int 34
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 35
 MGTP 3 Grant to public master..syscharsets  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public sybsystemprocs..sp_ijdbc_default_charset  
 MNER 3 No Error Check should check @@error after delete 21
 MNER 3 No Error Check should check @@error after insert 30
 MUCO 3 Useless Code Useless Brackets 34
 QISO 3 Set isolation level 28
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscharsets.csyscharsets unique clustered
(id, csid)
Intersection: {id}
34
 MSUB 2 Subquery Marker 34
 MTR1 2 Metrics: Comments Ratio Comments: 41% 18
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 2 = 1dec - 1exi + 2 18
 MTR3 2 Metrics: Query Complexity Complexity: 13 18

DEPENDENCIES
PROCS AND TABLES USED
writes table tempdb..#tmp_default_charset (1) 
reads table master..syscharsets (1)  
reads table master..sysconfigures (1)