DatabaseProcApplicationCreatedLinks
sybsystemprocssp_depends  14 déc. 14Defects Propagation Dependencies

1     
2     /* Sccsid = "%Z% generic/sproc/%M% %I% %G%" */
3     /*	4.8	1.1	06/14/90	sproc/src/defaultlanguage */
4     
5     /*
6     ** Messages for "sp_depends"            17460
7     **
8     ** 17029, "Dependencies for stored procedure %1! cannot be determined as ASE does not store dependencies for procedures created with the 'execute as caller' option."
9     ** 17460, "Object must be in the current database."
10    ** 17461, "Object does not exist in this database."
11    ** 17462, "Things the object references in the current database."
12    ** 17463, "Things inside the current database that reference the object."
13    ** 17464, "Object doesn't reference any object and no objects reference it."
14    ** 17465, "The specified column (or all columns, if none was specified) in %1! has no dependencies on other objects, and no other object depends on any columns from it."
15    ** 17466, "Dependent objects that reference column %1!."
16    ** 17467, "Dependent objects that reference all columns in the table. Use sp_depends on each column to get more information."
17    ** 17468, "Columns referenced in stored procedures, views  or triggers are not included in this report."
18    ** 17469, "Tables that reference this object: "
19    ** 19986, "The dependencies of the stored procedure cannot be determined until the first successful execution."
20    */
21    
22    /*
23    ** IMPORTANT NOTE:
24    ** This stored procedure uses the built-in function object_id() in the
25    ** where clause of a select query. If you intend to change this query
26    ** or use the object_id() or db_id() builtin in this procedure, please read the
27    ** READ.ME file in the $DBMS/generic/sproc directory to ensure that the rules
28    ** pertaining to object-id's and db-id's outlined there, are followed.
29    */
30    create or replace procedure sp_depends
31        @objname varchar(767) /* the object we want to check */
32        , @column_name varchar(255) = null /* the column we want to check */
33    as
34    
35        declare @found_some bit /* flag for table dependencies found */
36            , @msg varchar(1024)
37            , @sptlang int /* current sessions language */
38            , @length int
39            , @colid int /* column id from syscolumns */
40            , @objid int
41    
42        if @@trancount = 0
43        begin
44            set chained off
45        end
46    
47        set transaction isolation level 1
48        set nocount on
49    
50        /*
51        **  Make sure the @objname is local to the current database.
52        */
53        if @objname like "%.%.%" and
54            substring(@objname, 1, charindex(".", @objname) - 1) != db_name()
55        begin
56            /*
57            ** 17460, "Object must be in the current database."
58            */
59            raiserror 17460
60            return (1)
61        end
62    
63        /*
64        **  See if @objname exists.
65        */
66        select @objid = object_id(@objname)
67        if not exists (select id
68                from sysobjects
69                where id = @objid)
70        begin
71            /*
72            ** 17461, "Object does not exist in this database."
73            */
74            raiserror 17461
75            return (1)
76        end
77    
78        /* 
79        ** If a column name is provided, check that it exists in the said table.
80        */
81        if @column_name is not null
82        begin
83            select @colid = colid
84            from syscolumns
85            where id = @objid and name = @column_name
86    
87            if (@colid is NULL)
88            begin
89                /*
90                ** 17563, "The table does not have a column named '%1!'."
91                */
92                raiserror 17563, @column_name
93                return (1)
94            end
95        end
96    
97        /*
98        ** If procedure was created with execute as caller, then no information
99        ** is stored in sysdepends as the objects in the proc would be different
100       ** according to the executor of the proc. 
101       */
102       if exists (select sysstat3
103               from sysobjects
104               where id = @objid and sysstat3 & 512 = 512)
105       begin
106           /*
107           ** 17029, "Dependencies for stored procedure '%1!' cannot be
108           **	   determined as ASE does not store dependencies for procedures 
109           **	   created with the 'execute as caller' option."
110           */
111           exec sp_getmessage 17029, @msg output
112           print @msg, @objname
113   
114           return (0)
115       end
116   
117       /*
118       ** If procedure was created with deferred name resolution and
119       ** it was not executed already then indicate that dependencies
120       ** will be calculated after the first successfully execution.
121       */
122       if exists (select type
123               from sysprocedures
124               where id = @objid and type = 2048)
125       begin
126           /*
127           ** 19986, "The dependencies of the stored procedure cannot be 
128           **	   determined until the first successful execution."
129           */
130           exec sp_getmessage 19986, @msg output
131           print @msg
132   
133           return (0)
134       end
135   
136       /*
137       **  Initialize @found_some to indicate that we haven't seen any dependencies.
138       */
139       select @found_some = 0
140   
141       /*
142       **  Print out the particulars about the local dependencies.
143       */
144       if exists (select *
145               from sysdepends
146               where id = @objid)
147       begin
148           /*
149           ** 17462, "Things the object references in the current database."
150           */
151           exec sp_getmessage 17462, @msg output
152           print @msg
153   
154           select @sptlang = @@langid
155           if @@langid != 0
156           begin
157               if not exists (
158                       select * from master.dbo.sysmessages where error
159                           between 17010 and 17014
160                           and langid = @@langid)
161                   select @sptlang = 0
162               else
163               if not exists (
164                       select * from master.dbo.sysmessages where error
165                           between 17100 and 17109
166                           and langid = @@langid)
167                   select @sptlang = 0
168           end
169   
170           /* Check if this is a sqlj proc/func. If it is then the object 
171           ** will reference only a java class.
172           */
173           if exists (select *
174                   from sysdepends d, sysxtypes x
175                   where d.id = @objid
176                       and d.depid = x.xtid)
177   
178           begin
179               select object = x.xtname,
180                   type = "java class"
181               into #depend1result
182               from sysdepends d,
183                   sysxtypes x
184               where d.id = @objid
185                   and d.depid = x.xtid
186               exec sp_autoformat @fulltabname = #depend1result,
187                   @selectlist = "object, 'java class' = type"
188               drop table #depend1result
189           end
190           else
191           begin
192               select object = s.name + "." + o.name,
193                   type = convert(char(23), m0.description),
194                   updated = convert(char(10), m1.description),
195                   selected = convert(char(10), m2.description)
196               into #depend2result
197               from sysobjects o, master.dbo.spt_values v,
198                   sysdepends d, master.dbo.spt_values u,
199                   master.dbo.spt_values w,
200                   sysusers s,
201                   master.dbo.sysmessages m0,
202                   master.dbo.sysmessages m1,
203                   master.dbo.sysmessages m2
204               where o.id = d.depid
205                   and o.sysstat & 15 = v.number and
206                   /* Pulling data from table/view/procedure Objects
207                   OR PRS Objects*/
208                   ((v.type = 'O' and o.type != 'RS') or
209                       (v.type = 'O1' and o.type = 'RS'))
210                   and v.msgnum = m0.error
211                   and isnull(m0.langid, 0) = @sptlang
212                   and u.type = 'B' and u.number = d.resultobj
213                   and u.msgnum = m1.error
214                   and isnull(m1.langid, 0) = @sptlang
215                   and w.type = 'B' and w.number = d.readobj
216                   and w.msgnum = m2.error
217                   and isnull(m2.langid, 0) = @sptlang
218                   and d.id = @objid
219                   and o.uid = s.uid
220               exec sp_autoformat @fulltabname = #depend2result
221               drop table #depend2result
222           end
223           select @found_some = 1
224       end
225   
226       /*
227       **  Now check for things that the objects depends upon
228       */
229       if exists (select *
230               from sysdepends
231               where depid = @objid)
232       begin
233           /*
234           ** 17463, "Things inside the current database that reference the object."
235           */
236           exec sp_getmessage 17463, @msg output
237           print @msg
238           select distinct
239               object = s.name + "." + o.name,
240               type = (case
241                   when (o.type = "IT")
242                   then "instead of "
243                   else null
244               end)
245               + (v.name)
246           into #depend3result
247           from sysobjects o, master.dbo.spt_values v,
248               sysdepends d, sysusers s
249           where o.id = d.id
250               and o.sysstat & 15 = v.number
251               and
252               /* Pulling data from table/view/procedure Objects
253               OR PRS Objects*/
254               ((v.type = 'O' and o.type != 'RS') or
255                   (v.type = 'O1' and o.type = 'RS'))
256               and d.depid = @objid
257               and o.uid = s.uid
258               -- Match on column name, if  one is provided.
259               and (@column_name IS NULL
260                   or exists
261                       (select *
262                       from master..spt_values v2
263                       where v2.type = "P"
264                           and v2.number <= 1024
265                           and @column_name = col_name(d.depid, v2.number)
266                           and ((convert(tinyint, substring(isnull(d.columns, 0x1),
267                                   v2.low, 1))
268                               & v2.high) != 0)
269                       )
270               )
271           exec sp_autoformat @fulltabname = #depend3result,
272               @selectlist = "object, type",
273               @orderby = "order by object"
274           drop table #depend3result
275           select @found_some = 1
276       end
277   
278       /* If this object aplied to a column in a table we want to
279       ** display the table name that references it (used for rules and 
280       ** defaults).
281       */
282   
283       if exists (select *
284               from syscolumns
285               where @objid IN (cdefault, domain, accessrule))
286       begin
287           /*
288           **  17469, "Tables that reference this object: "
289           */
290           exec sp_getmessage 17469, @msg output
291           print @msg
292           select distinct
293               object = u.name + "." + o.name
294           into #depend4result
295           from syscolumns c, sysobjects o, sysusers u
296           where @objid IN (c.cdefault, c.domain, c.accessrule)
297               and c.id = o.id
298               and o.uid = u.uid
299           exec sp_autoformat @fulltabname = #depend4result
300           drop table #depend4result
301           select @found_some = 1
302       end
303   
304       /*
305       **  Did we find anything in sysdepends?
306       */
307       if (@found_some = 0)
308       begin
309           /*
310           ** 17464, "Object doesn't reference any object and no objects reference it."
311           */
312           exec sp_getmessage 17464, @msg output
313           print @msg
314       end
315   
316   
317       /*
318       ** If object is something other than a table (i.e. view, rule, default,
319       ** trigger etc., return immediately, without further processing for
320       ** column level dependencies. These do not apply to non-table objects,
321       ** and will needlessly add to the processing time for, say, views with
322       ** large number of columns.
323       */
324       if (select type from sysobjects
325               where id = @objid) not in ('U', 'S', 'RS')
326       begin
327           return (0)
328       end
329   
330       /*
331       ** =========================================================================
332       ** Start of column level dependency processing.
333       ** =========================================================================
334       */
335   
336       /*
337       ** Store results in #column_depends as we go
338       */
339       if ((select object_id("#column_depends")) is NULL)
340       begin
341           create table #column_depends(
342               Type varchar(23)
343               , Property varchar(11)
344               , Dependency varchar(255) -- @Depend_col_length = 255
345               , Column varchar(255)
346               , AlsoSee varchar(100)
347           ) lock allpages
348       end
349   
350       declare @Depend_col_length int
351   
352       -- Length of Dependency column in output table
353       select @Depend_col_length = 255
354   
355       /*
356       ** =========================================================================
357       ** If no column name was specified, generate dependencies for all columns
358       ** in the table. Output one result at the end of the procedure.
359       */
360       if @column_name is null
361       begin
362           declare colcur cursor for
363           select name from syscolumns where id = @objid
364   
365           open colcur
366           fetch colcur into @column_name
367   
368           while (@@sqlstatus != 2)
369           begin
370               -- Change recursion level to skip table-level dependency code
371               exec sp_depends_cols @objname, @column_name
372                   , @findTableLevelConstraints = 1
373   
374               fetch colcur into @column_name
375           end
376   
377           close colcur
378           deallocate cursor colcur
379   
380           -- To flag output of column name in end result.
381           select @column_name = NULL
382   
383           -- Special case code to pick out check constraints defined at the
384           -- table level. These appear with colid==0 in SYSCONSTRAINTS and
385           -- do not have status bits 0x0200, 0x0400, or 0x0800 set. Get
386           -- their info, and display them in the summary output report.
387           --
388           if exists (select colid from sysconstraints
389                   where tableid = @objid
390                       and status & 3584 = 0 -- not a trigger reference
391                       and colid = 0) -- table level constraints
392           begin
393               insert into #column_depends
394               select "table-level check constraint"
395                   , "constraint"
396                   , object_name(constrid)
397                   + " (Table-level check constraint)"
398                   , "(Unknown column name)"
399                   , "sp_helpconstraint, alter table drop constraint"
400               from sysconstraints
401               where tableid = @objid
402                   and status & 3584 = 0 -- not a trigger reference
403                   and colid = 0
404           end
405       end
406       else
407       begin
408           -- Find column-level dependencies for just this one column.
409           exec sp_depends_cols @objname, @column_name
410               , @findTableLevelConstraints = 0
411       end
412   
413       /*
414       ** =========================================================================
415       **  Did we find anything for the specified column, or for all columns?
416       */
417   
418       -- Only do printing when we are in the first invocation of this sproc,
419       -- and not when we recurse to process each column.
420       --
421       -- Check and report if no column-level dependencies were found.
422       if ((select count(*) from #column_depends) = 0)
423       begin
424           exec sp_getmessage 17465, @msg output
425           print @msg, @objname
426   
427           return (0)
428       end
429   
430       -- Report on dependencies for the specified column.
431       if (@column_name is not NULL)
432       begin
433           exec sp_getmessage 17466, @msg output
434           print @msg, @column_name
435   
436           exec sp_getmessage 17468, @msg output
437           print @msg
438   
439           exec sp_autoformat @fulltabname = #column_depends,
440               @selectlist = "Type, Property,
441   		'Object Names or Column Names' = Dependency,
442   		'Also see/Use command' = AlsoSee",
443               @orderby = "order by Type"
444       end
445   
446       -- Report on dependencies for all columns in the table.
447       else
448       begin
449           print " "
450           exec sp_getmessage 17467, @msg output
451           print @msg
452   
453           exec sp_getmessage 17468, @msg output
454           print @msg
455   
456           print " "
457   
458           exec sp_autoformat @fulltabname = #column_depends,
459               @selectlist = "Column, Type,
460   		'Object Names or Column Names' = Dependency",
461               @orderby = "order by Column, Type"
462       end
463       drop table #column_depends
464       set nocount off
465       return (0)
466   


exec sp_procxmode 'sp_depends', 'AnyMode'
go

Grant Execute on sp_depends to public
go
DEFECTS
 QJWI 5 Join or Sarg Without Index 265
 QJWI 5 Join or Sarg Without Index 285
 MINU 4 Unique Index with nullable columns master..sysmessages master..sysmessages
 MINU 4 Unique Index with nullable columns sybsystemprocs..sysxtypes sybsystemprocs..sysxtypes
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 186
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 220
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 271
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 299
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 439
 MUSP 4 Unquoted String Parameter sybsystemprocs..sp_autoformat: @fulltabname 458
 QCSC 4 Costly 'select count()', use 'exists()' 422
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {depid}
231
 QPUI 4 Join or Sarg with Un-Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {depid}
256
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 124
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 160
 QTYP 4 Comparison type mismatch smallint = int 160
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 166
 QTYP 4 Comparison type mismatch smallint = int 166
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 391
 QTYP 4 Comparison type mismatch Comparison type mismatch: smallint vs int 403
 TNOU 4 Table with no unique index master..spt_values master..spt_values
 CUNU 3 Cursor not updated: cursor should contain 'for read only' clause colcur 363
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 67
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 69
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 85
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 104
 MAW1 3 Warning message on %name% sybsystemprocs..sysprocedures.id: Warning message on sysprocedures 124
 MAW1 3 Warning message on %name% sybsystemprocs..sysdepends.id: Warning message on sysdepends 146
 MAW1 3 Warning message on %name% sybsystemprocs..sysdepends.id: Warning message on sysdepends 175
 MAW1 3 Warning message on %name% sybsystemprocs..sysdepends.id: Warning message on sysdepends 184
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 204
 MAW1 3 Warning message on %name% sybsystemprocs..sysdepends.id: Warning message on sysdepends 218
 MAW1 3 Warning message on %name% sybsystemprocs..sysdepends.id: Warning message on sysdepends 249
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 249
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 297
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 297
 MAW1 3 Warning message on %name% sybsystemprocs..sysobjects.id: Warning message on sysobjects 325
 MAW1 3 Warning message on %name% sybsystemprocs..syscolumns.id: Warning message on syscolumns 363
 MBLI 3 Integer Value of Binary Literal is Platform Dependant 266
 MGTP 3 Grant to public master..spt_values  
 MGTP 3 Grant to public master..sysmessages  
 MGTP 3 Grant to public sybsystemprocs..sp_depends  
 MGTP 3 Grant to public sybsystemprocs..syscolumns  
 MGTP 3 Grant to public sybsystemprocs..sysconstraints  
 MGTP 3 Grant to public sybsystemprocs..sysdepends  
 MGTP 3 Grant to public sybsystemprocs..sysobjects  
 MGTP 3 Grant to public sybsystemprocs..sysprocedures  
 MGTP 3 Grant to public sybsystemprocs..sysusers  
 MGTP 3 Grant to public sybsystemprocs..sysxtypes  
 MNER 3 No Error Check should check return value of exec 111
 MNER 3 No Error Check should check return value of exec 130
 MNER 3 No Error Check should check return value of exec 151
 MNER 3 No Error Check should check @@error after select into 179
 MNER 3 No Error Check should check return value of exec 186
 MNER 3 No Error Check should check @@error after select into 192
 MNER 3 No Error Check should check return value of exec 220
 MNER 3 No Error Check should check return value of exec 236
 MNER 3 No Error Check should check @@error after select into 238
 MNER 3 No Error Check should check return value of exec 271
 MNER 3 No Error Check should check return value of exec 290
 MNER 3 No Error Check should check @@error after select into 292
 MNER 3 No Error Check should check return value of exec 299
 MNER 3 No Error Check should check return value of exec 312
 MNER 3 No Error Check should check return value of exec 371
 MNER 3 No Error Check should check @@error after insert 393
 MNER 3 No Error Check should check return value of exec 409
 MNER 3 No Error Check should check return value of exec 424
 MNER 3 No Error Check should check return value of exec 433
 MNER 3 No Error Check should check return value of exec 436
 MNER 3 No Error Check should check return value of exec 439
 MNER 3 No Error Check should check return value of exec 450
 MNER 3 No Error Check should check return value of exec 453
 MNER 3 No Error Check should check return value of exec 458
 MUCO 3 Useless Code Useless Brackets 60
 MUCO 3 Useless Code Useless Brackets 75
 MUCO 3 Useless Code Useless Brackets 87
 MUCO 3 Useless Code Useless Brackets 93
 MUCO 3 Useless Code Useless Brackets 114
 MUCO 3 Useless Code Useless Brackets 133
 MUCO 3 Useless Code Useless Brackets 240
 MUCO 3 Useless Code Useless Brackets 241
 MUCO 3 Useless Code Useless Brackets 245
 MUCO 3 Useless Code Useless Brackets 307
 MUCO 3 Useless Code Useless Brackets 327
 MUCO 3 Useless Code Useless Brackets 339
 MUCO 3 Useless Code Useless Brackets 368
 MUCO 3 Useless Code Useless Brackets 422
 MUCO 3 Useless Code Useless Brackets 427
 MUCO 3 Useless Code Useless Brackets 431
 MUCO 3 Useless Code Useless Brackets 465
 MUIN 3 Column created using implicit nullability 341
 QAFM 3 Var Assignment from potentially many rows 83
 QCTC 3 Conditional Table Creation 179
 QCTC 3 Conditional Table Creation 192
 QCTC 3 Conditional Table Creation 238
 QCTC 3 Conditional Table Creation 292
 QCTC 3 Conditional Table Creation 341
 QDIS 3 Check correct use of 'select distinct' 238
 QDIS 3 Check correct use of 'select distinct' 292
 QGWO 3 Group by/Distinct/Union without order by 238
 QGWO 3 Group by/Distinct/Union without order by 292
 QISO 3 Set isolation level 47
 QMTB 3 From clause with many tables 9 197
 QNAJ 3 Not using ANSI Inner Join 174
 QNAJ 3 Not using ANSI Inner Join 182
 QNAJ 3 Not using ANSI Inner Join 197
 QNAJ 3 Not using ANSI Inner Join 247
 QNAJ 3 Not using ANSI Inner Join 295
 QPNC 3 No column in condition 259
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
85
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysprocedures.csysprocedures unique clustered
(id, number, type, sequence)
Intersection: {type, id}
124
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {id}
146
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
158
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error, langid}
164
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {id}
175
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {id}
184
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
210
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
213
 QPRI 3 Join or Sarg with Rooted Partial Index Use JOIN Candidate index: sysmessages.ncsysmessages unique
(error, dlevel, langid)
Intersection: {error}
Uncovered: [dlevel]
216
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: sysdepends.csysdepends unique clustered
(id, number, depid, depnumber)
Intersection: {id}
218
 QPRI 3 Join or Sarg with Rooted Partial Index Use SARG Candidate index: syscolumns.csyscolumns unique clustered
(id, number, colid)
Intersection: {id}
363
 QSWV 3 Sarg with variable @objid, Candidate Index: sysconstraints.csysconstraints clustered(tableid, colid) S 389
 QSWV 3 Sarg with variable @objid, Candidate Index: sysconstraints.csysconstraints clustered(tableid, colid) S 401
 VNRD 3 Variable is not read @Depend_col_length 353
 VUNU 3 Variable is not used @length 38
 CUPD 2 Updatable Cursor Marker (updatable by default) 363
 MSUB 2 Subquery Marker 67
 MSUB 2 Subquery Marker 102
 MSUB 2 Subquery Marker 122
 MSUB 2 Subquery Marker 144
 MSUB 2 Subquery Marker 157
 MSUB 2 Subquery Marker 163
 MSUB 2 Subquery Marker 173
 MSUB 2 Subquery Marker 229
 MSUB 2 Subquery Marker 283
 MSUB 2 Subquery Marker 324
 MSUB 2 Subquery Marker 388
 MSUC 2 Correlated Subquery Marker 261
 MTR1 2 Metrics: Comments Ratio Comments: 43% 30
 MTR2 2 Metrics: Cyclomatic Complexity Cyclo: 60 = 66dec - 8exi + 2 30
 MTR3 2 Metrics: Query Complexity Complexity: 227 30
 PRED_QUERY_COLLECTION 2 {d=sybsystemprocs..sysdepends, x=sybsystemprocs..sysxtypes} 0 173
 PRED_QUERY_COLLECTION 2 {d=sybsystemprocs..sysdepends, x=sybsystemprocs..sysxtypes} 0 179
 PRED_QUERY_COLLECTION 2 {d=sybsystemprocs..sysdepends, m=master..sysmessages, m2=master..sysmessages, m3=master..sysmessages, o=sybsystemprocs..sysobjects, sv=master..spt_values, sv2=master..spt_values, sv3=master..spt_values, u=sybsystemprocs..sysusers} 0 192
 PRED_QUERY_COLLECTION 2 {d=sybsystemprocs..sysdepends, o=sybsystemprocs..sysobjects, sv=master..spt_values, u=sybsystemprocs..sysusers} 0 238
 PRED_QUERY_COLLECTION 2 {c=sybsystemprocs..syscolumns, o=sybsystemprocs..sysobjects, u=sybsystemprocs..sysusers} 0 292

DEPENDENCIES
PROCS AND TABLES USED
writes table tempdb..#depend1result (1) 
reads table sybsystemprocs..syscolumns  
reads table sybsystemprocs..sysprocedures  
reads table sybsystemprocs..sysusers  
reads table master..sysmessages (1)  
reads table sybsystemprocs..sysxtypes  
reads table sybsystemprocs..sysobjects  
calls proc sybsystemprocs..sp_getmessage  
   reads table sybsystemprocs..sysusermessages  
   reads table master..syslanguages (1)  
   calls proc sybsystemprocs..sp_validlang  
      reads table master..syslanguages (1)  
   reads table master..sysmessages (1)  
writes table tempdb..#depend4result (1) 
reads table sybsystemprocs..sysdepends  
calls proc sybsystemprocs..sp_depends_cols  
   writes table tempdb..#column_depends (1) 
   reads table sybsystemprocs..sysreferences  
   calls proc sybsystemprocs..sp_getmessage  
   reads table sybsystemprocs..sysobjects  
   reads table sybsystemprocs..sysprotects  
   reads table sybsystemprocs..sysconstraints  
   reads table sybsystemprocs..syskeys  
   reads table sybsystemprocs..syscolumns  
   reads table sybsystemprocs..sysindexes  
   reads table master..spt_values (1)  
   reads table sybsystemprocs..sysstatistics  
   reads table sybsystemprocs..sysprocedures  
writes table tempdb..#depend2result (1) 
reads table sybsystemprocs..sysconstraints  
calls proc sybsystemprocs..sp_autoformat  
   calls proc sybsystemprocs..sp_namecrack  
   writes table sybsystemprocs..sp_autoformat_rset_002 
   writes table sybsystemprocs..sp_autoformat_rset_003 
   calls proc sybsystemprocs..sp_autoformat  
   reads table tempdb..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_005 
   read_writes table tempdb..#colinfo_af (1) 
   reads table master..systypes (1)  
   writes table sybsystemprocs..sp_autoformat_rset_004 
   writes table sybsystemprocs..sp_autoformat_rset_001 
   reads table tempdb..syscolumns (1)  
   reads table master..syscolumns (1)  
read_writes table tempdb..#column_depends (1) 
writes table tempdb..#depend3result (1) 
reads table master..spt_values (1)