DatabaseProcApplicationCreatedLinks
sybsystemprocssp_show_options  31 Aug 14Defects Dependencies

1     
2     
3     /* 
4     ** This stored procedure prints all the server options, which have been set in
5     ** current session. @@options the array of bits corresponding to server options.
6     ** For every option, "low" is the byte number in @@options, and "high" is the 
7     ** bit within that byte corresponding to the option. If the bit is set, print
8     ** name of that option.
9     */
10    create procedure sp_show_options
11    as
12        select a.number, a.name
13        from master.dbo.spt_values a, master.dbo.spt_values c
14        where c.type = "P"
15            and a.type = 'N'
16            and c.low <= datalength(@@options)
17            and a.number = c.number
18            and convert(tinyint, substring(@@options, c.low, 1)) & c.high != 0
19        return (0)
20    


exec sp_procxmode 'sp_show_options', 'AnyMode'
go

Grant Execute on sp_show_options to public
go
RESULT SETS
sp_show_options_rset_001

DEFECTS
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public sybsystemprocs..sp_show_options  
 MUCO 3 Useless Code Useless Brackets 19
 QNAJ 3 Not using ANSI Inner Join 13
 QSWV 3 Sarg with variable @@options, Candidate Index: spt_values.spt_valuesclust clustered(number, type) U 16
 MRST 2 Result Set Marker 12
 MTR1 2 Metrics: Comments Ratio Comments: 45% 10
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 1 = 0dec - 1exi + 2 10
 MTR3 2 Metrics: Query Complexity Complexity: 10 10
 PRED_QUERY_COLLECTION 2 {sv=master..spt_values, sv2=master..spt_values} 0 12

DEPENDENCIES
PROCS AND TABLES USED
reads table master..spt_values (1)