Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 12 Mar 2002 @ 12:26:01 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Object dependancies
 
From:   Dieter Nöth

sel *
  from dbc.tables
  where position('tvm' in requesttext) > 0
    and position('dbc' in requesttext) > 0
  order by ...;
  This will find all views or macros which reference "dbc.tvm". It may well find a few spurious entries as well, but it should be pretty close.  



If you use tvm.CreateText instead of RequestText, this will work with referenced Macros/Views, too. I use following macro:

replace macro Dependencies
  ( DBName varchar(30) default database
   ,TableName varchar(30)
  )
as
(
  select
    dbase.databasename
   ,tvm.tvmname
   ,tvm.tablekind
  from
    dbc.tvm join dbc.dbase
    on tvm.databaseid = dbase.databaseid
  where
    tvm.createtext like '%"'|| :DBName || '"."' || :TableName || '"%'
  and not
   (dbase.databasename = :DBName and tvm.tvmname = :TableName);
);

exec dependencies('dbc', 'tables');

There may be a faulty record, if there's a table with DBName and a column with TableName, but i never cared about it. I always thought about modifying it to a stored procedure for nested views, but never needed it.


Dieter



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016