DB2 Views
10 pts.
0
Q:
DB2 Views
How to find the number of views for a DB2 table?
ASKED: May 28 2009  10:02 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
1840 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
A query against the DB2 catalog will answer your question.

To find the number of views, something like this will work:
SELECT COUNT(*) from SYSIBM.SYSVIEWDEP
WHERE BTYPE = 'V' -- this means VIEW
AND BNAME = 'name of table in question'

To find the names of the views on a given table, something like this:
SELECT DCREATOR, DNAME <-- the CREATOR & NAME of the view
FROM SYSIBM.SYSVIEWDEP
WHERE BNAME = 'a given table'
AND BCREATOR = 'owner of the given table'
ORDER BY ...

===

part 2 - It was pointed out that I had mistyped the columns in the SELECT list in the second query above. These have been corrected.

meandyou (Steve)
Last Answered: Sep 23 2009  3:37 PM GMT by Meandyou   1840 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0