|
|
Archives of the TeradataForum
Message Posted: Tue, 12 Mar 2002 @ 12:26:01 GMT
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
| |