DatabaseProcApplicationCreatedLinks
sybsystemprocssp_addtabledef  31 Aug 14Defects Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/src/%M% %I% %G%" */
3     
4     /*
5     ** Omni only
6     **
7     ** Messages for "sp_addtabledef".  Additional messages are issued from
8     ** sp_addobjectdef, which this procedure invokes.
9     **
10    ** 18312, "Object type is '%1!'."
11    ** 18313, "Unrecognized storage_location type '%1!'."
12    */
13    
14    create procedure sp_addtabledef
15        @tablename varchar(1023), /* local table name */
16        @objectdef varchar(255), /* path to remote/external object */
17        @objecttype varchar(10) = "table" /* object type  */
18    as
19        begin
20    
21            declare @msg varchar(1024),
22                @status int
23    
24            /*
25            ** See if the objectdef actually represents a remote server
26            ** object.
27            */
28            if exists (select * from master.dbo.spt_values where type = 'E' and name = 'vms')
29            begin
30                if charindex(":", @objectdef) > 0
31                begin
32                    /*
33                    ** 18312, "Object type is '%1!'."
34                    */
35                    select @objecttype = "file"
36                    exec sp_getmessage 18312, @msg output
37                    print @msg, @objecttype
38                end
39            end
40            else if @objectdef like "%.%.%.%"
41            begin
42                /*
43                ** 18312, "Object type is '%1!'."
44                */
45                select @objecttype = "table"
46                exec sp_getmessage 18312, @msg output
47                print @msg, @objecttype
48            end
49            else
50            begin
51                /*
52                ** 18313, Unable to determine storage_location type for '%1!'
53                */
54                raiserror 18313, @objectdef
55                return (1)
56            end
57    
58            exec @status = sp_addobjectdef @tablename, @objectdef, @objecttype
59    
60            return (@status)
61        end
62    


exec sp_procxmode 'sp_addtabledef', 'AnyMode'
go

Grant Execute on sp_addtabledef to public
go
DEFECTS
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: spt_values.spt_valuesclust clustered
(number, type)
Intersection: {type}
28
 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_addtabledef  
 MNER 3 No Error Check should check return value of exec 36
 MNER 3 No Error Check should check return value of exec 46
 MNER 3 No Error Check should check return value of exec 58
 MUCO 3 Useless Code Useless Begin-End Pair 19
 MUCO 3 Useless Code Useless Brackets 55
 MUCO 3 Useless Code Useless Brackets 60
 MSUB 2 Subquery Marker 28
 MTR1 2 Metrics: Comments Ratio Comments: 37% 14
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 4 = 4dec - 2exi + 2 14
 MTR3 2 Metrics: Query Complexity Complexity: 21 14

DEPENDENCIES
PROCS AND TABLES USED
calls proc sybsystemprocs..sp_addobjectdef  
   reads table master..spt_values (1)  
   calls proc sybsystemprocs..sp_namecrack  
   reads table sybsystemprocs..sysobjects  
   reads table master..sysservers (1)  
   reads table sybsystemprocs..syscolumns  
   read_writes table sybsystemprocs..sysattributes  
   calls proc sybsystemprocs..sp_iqdbcheck  
reads table master..spt_values (1)  
calls proc sybsystemprocs..sp_getmessage  
   reads table master..sysmessages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..syslanguages (1)  
   reads table sybsystemprocs..sysusermessages