DatabaseProcApplicationCreatedLinks
sybsystemprocssp_default_charset  14 déc. 14Defects Propagation Dependencies

1     
2     /*
3     **  create a procedure that will query the datasource
4     **  specific syscharset, and sysconfigures tables, and do a join to 
5     **  determine what is the correct charset that has been set as a default
6     **  on the server.
7     */
8     create or replace procedure sp_default_charset
9     as
10    
11        if @@trancount = 0
12        begin
13            set chained off
14        end
15    
16        set transaction isolation level 1
17    
18        select name as DEFAULT_CHARSET from master.dbo.syscharsets
19        where ((select value from master.dbo.sysconfigures
20                    where config = 131) /* default charset id */
21                = master.dbo.syscharsets.id)
22    


exec sp_procxmode 'sp_default_charset', 'AnyMode'
go

Grant Execute on sp_default_charset to public
go
RESULT SETS
sp_default_charset_rset_001

DEFECTS
 MINU 4 Unique Index with nullable columns master..sysconfigures master..sysconfigures
 QTYP 4 Comparison type mismatch Comparison type mismatch: int vs tinyint 19
 QTYP 4 Comparison type mismatch tinyint = int 19
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 20
 MAW1 3 Warning message on %name% master..syscharsets.id: Warning message on syscharsets 21
 MGTP 3 Grant to public master..syscharsets  
 MGTP 3 Grant to public master..sysconfigures  
 MGTP 3 Grant to public sybsystemprocs..sp_default_charset  
 MUCO 3 Useless Code Useless Brackets 19
 QISO 3 Set isolation level 16
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscharsets.csyscharsets unique clustered
(id, csid)
Intersection: {id}
19
 MRST 2 Result Set Marker 18
 MSUB 2 Subquery Marker 19
 MTR1 2 Metrics: Comments Ratio Comments: 31% 8
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 2dec - 1exi + 2 8
 MTR3 2 Metrics: Query Complexity Complexity: 10 8

DEPENDENCIES
PROCS AND TABLES USED
reads table master..sysconfigures (1)  
writes table sybsystemprocs..sp_default_charset_rset_001 
reads table master..syscharsets (1)