DatabaseProcApplicationCreatedLinks
sybsystemprocssp_dropextendedproc  31 Aug 14Defects Dependencies

1     
2     
3     /*
4     ** Messages from dropextendedproc
5     **
6     ** 17260, "Can't run %1! from within a transaction." 
7     ** 18388, "You must be in the 'master' database in order to run %1!
8     ** 17240, "'%1!' is not a valid name."
9     ** 18389, "sp_dropextendedproc failed."
10    */
11    create procedure sp_dropextendedproc
12        @esp_name varchar(255)
13    as
14    
15        declare @maxlen int
16    
17        /* If we're not in master, disallow this */
18    
19        if db_name() != "master"
20        begin
21            /*
22            ** 18388, "You must be in the 'master' database in order to run %1!
23            */
24            raiserror 18388, "sp_dropextendedproc"
25            return (1)
26        end
27    
28        /*
29        **  If we're in a transaction, disallow this since it might make recovery
30        **  impossible.
31        */
32        if @@trancount > 0
33        begin
34            /*
35            ** 17260, "Can't run %1! from within a transaction." 
36            */
37            raiserror 17260, "sp_dropextendedproc"
38            return (1)
39        end
40    
41        set chained off
42    
43        set transaction isolation level 1
44        /* check if user has sa role, proc_role will also do auditing
45        ** if required. proc_role will also print an error message if required.
46        */
47        if (proc_role("sa_role") = 0)
48            return (1)
49    
50        /* check that esp_name is a valid identifier */
51        select @maxlen = length from syscolumns
52        where id = object_id("sysobjects") and name = "name"
53    
54        if valid_name(@esp_name, @maxlen) = 0
55        begin
56            /*
57            ** 17240, "'%1!' is not a valid name."
58            */
59            raiserror 17240, @esp_name
60            return (1)
61        end
62    
63        dbcc dropextendedproc(@esp_name)
64    
65        if (@@error != 0)
66        begin
67            /*
68            ** 18389, "sp_dropextendedproc failed."
69            */
70            raiserror 18389
71            return (1)
72        end
73    
74        return (0)
75    


exec sp_procxmode 'sp_dropextendedproc', 'AnyMode'
go

Grant Execute on sp_dropextendedproc to public
go
DEFECTS
 MGTP 3 Grant to public sybsystemprocs..sp_dropextendedproc  
 MGTP 3 Grant to public sybsystemprocs..syscolumns  
 MUCO 3 Useless Code Useless Brackets 25
 MUCO 3 Useless Code Useless Brackets 38
 MUCO 3 Useless Code Useless Brackets 47
 MUCO 3 Useless Code Useless Brackets 48
 MUCO 3 Useless Code Useless Brackets 60
 MUCO 3 Useless Code Useless Brackets 65
 MUCO 3 Useless Code Useless Brackets 71
 MUCO 3 Useless Code Useless Brackets 74
 QAFM 3 Var Assignment from potentially many rows 51
 QISO 3 Set isolation level 43
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
52
 MTR1 2 Metrics: Comments Ratio Comments: 52% 11
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 3 = 6dec - 5exi + 2 11
 MTR3 2 Metrics: Query Complexity Complexity: 29 11

DEPENDENCIES
PROCS AND TABLES USED
reads table sybsystemprocs..syscolumns