|
|
Archives of the TeradataForum
Message Posted: Tue, 23 Oct 2001 @ 23:26:26 GMT
Subj: | | Re: Need Cross Reference List of View to Table |
|
From: | | Emily Parsons |
Try this........
SELECT
TBL.DATABASENAME (CHAR(30)),
TBL.TABLENAME (CHAR(18)),
VW.DATABASENAME (CHAR(30)),
VW.TABLENAME (CHAR(18))
FROM DBC.TABLES VW,
DBC.TABLES TBL,
DBC.DATABASES VDB,
DBC.DATABASES TDB
WHERE
(INDEX(VW.REQUESTTEXT,
TRIM(TBL.DATABASENAME)||'.'||TRIM(TBL.TABLENAME)||' ') > 0
OR
INDEX(VW.REQUESTTEXT,
TRIM(TBL.DATABASENAME)||'.'||TRIM(TBL.TABLENAME)||',') > 0
OR
INDEX(VW.REQUESTTEXT,
TRIM(TBL.DATABASENAME)||'.'||TRIM(TBL.TABLENAME)||';') > 0)
AND VW.DATABASENAME = VDB.DATABASENAME
AND TBL.DATABASENAME = TDB.DATABASENAME
AND VDB.OWNERNAME = 'VIEW_GROUP'
AND TDB.OWNERNAME = 'TABLE_GROUP' ;
VIEW_GROUP and TABLE_GROUP are the ownernames we assign to views and tables.
| |