home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / datatl25.zip / DCTDSGN.Z / EWSQDMPD.QRY < prev    next >
Text File  |  1997-09-11  |  3KB  |  130 lines

  1. #NAME#
  2. DA_DB2390PhysicalDesignContents
  3. #DESCRIPTION#
  4. The PhysicalDesignContents relationship query returns the names of all DB2/390 tables, views, aliases, indexes, tablespaces, storage groups, bufferpools, and databases which are contained in the specified DB2/390 Physical Design.  The query is sorted on the lastUpdate timestamp so you can find the objects which have changed most recently.
  5.  
  6. View type:  DAQDB2390PhysicalDesign
  7.  
  8. Modifications:
  9. The query uses a SQL UNION clause to provide a more compact and readable table. In order to change the search criteria, you must change it for each subselect statement in the UNION.  Change the search criteria of the Physical Design name using the = (equals), IN or LIKE elements in the SQL WHERE clause.  
  10.  
  11. In order to provide unique  names, the PhysicalDesign name has the format <>RelationalDesignName:PhysicalDesignName<variation:revision>
  12. To locate a Physical Design name used in multiple Relational Designs, use the LIKE clause with % after the first two angle brackets and before the colon.
  13. #MODIFIED#
  14.  
  15. #VERSION#
  16.  
  17. #SQL STATEMENT#
  18. SELECT
  19.   d.db2390PhysicalDesign,
  20.   t.db2390Table as objectName,
  21.   'Table' as partType,
  22.   p.lastUpdate,
  23.   p.addDate
  24. FROM 
  25.   DAQDB2390PhysicalDesign d,
  26.   (d.db2390Table) t,
  27.   PartView p
  28. WHERE
  29.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  30.   t.db2390Table=p.baseName
  31. UNION
  32. SELECT
  33.   d.db2390PhysicalDesign,
  34.   ts.db2390Tablespace as objectName,
  35.   'Tablespace' as partType,
  36.   p.lastUpdate,
  37.   p.addDate
  38. FROM 
  39.   DAQDB2390PhysicalDesign d,
  40.   (d.db2390Tablespace) ts,
  41.   PartView p
  42. WHERE
  43.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  44.   ts.db2390Tablespace=p.baseName
  45. UNION
  46. SELECT
  47.   d.db2390PhysicalDesign,
  48.   v.db2390View as objectName,
  49.   'View' as partType,
  50.   p.lastUpdate,
  51.   p.addDate
  52. FROM 
  53.   DAQDB2390PhysicalDesign d,
  54.   (d.db2390View) v,
  55.   PartView p
  56. WHERE
  57.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  58.   v.db2390View=p.baseName
  59. UNION
  60. SELECT
  61.   d.db2390PhysicalDesign,
  62.   i.db2390Index as objectName,
  63.   'Index' as partType,
  64.   p.lastUpdate,
  65.   p.addDate
  66. FROM 
  67.   DAQDB2390PhysicalDesign d,
  68.   (d.db2390Index) i,
  69.   PartView p
  70. WHERE
  71.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  72.   i.db2390Index=p.baseName
  73. UNION
  74. SELECT
  75.   d.db2390PhysicalDesign,
  76.   a.db2390AliasOrSynonym as objectName,
  77.   'Alias/Synonym' as partType,
  78.   p.lastUpdate,
  79.   p.addDate
  80. FROM 
  81.   DAQDB2390PhysicalDesign d,
  82.   (d.aliasOrSynonym) a,
  83.   PartView p
  84. WHERE
  85.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  86.   a.db2390AliasOrSynonym=p.baseName
  87. UNION
  88. SELECT
  89.   d.db2390PhysicalDesign,
  90.   db.db2390Database as objectName,
  91.   'Database' as partType,
  92.   p.lastUpdate,
  93.   p.addDate
  94. FROM 
  95.   DAQDB2390PhysicalDesign d,
  96.   (d.db2390Database) db,
  97.   PartView p
  98. WHERE
  99.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  100.   db.db2390Database=p.baseName
  101. UNION
  102. SELECT
  103.   d.db2390PhysicalDesign,
  104.   sg.db2390Storagegroup as objectName,
  105.   'Storage Group' as partType,
  106.   p.lastUpdate,
  107.   p.addDate
  108. FROM 
  109.   DAQDB2390PhysicalDesign d,
  110.   (d.db2390Storagegroup) sg,
  111.   PartView p
  112. WHERE
  113.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  114.   sg.db2390Storagegroup=p.baseName
  115. UNION
  116. SELECT
  117.   d.db2390PhysicalDesign,
  118.   b.db2390Bufferpool as objectName,
  119.   'Bufferpool' as partType,
  120.   p.lastUpdate,
  121.   p.addDate
  122. FROM 
  123.   DAQDB2390PhysicalDesign d,
  124.   (d.db2390Bufferpool) b,
  125.   PartView p
  126. WHERE
  127.   d.db2390PhysicalDesign LIKE '<>%:%' AND
  128.   b.db2390Bufferpool=p.baseName
  129. ORDER BY 4 DESC;
  130.