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

  1. #NAME#
  2. DA_DB2udbPhysicalDesignContents
  3. #DESCRIPTION#
  4. The PhysicalDesignContents relationship query returns the names of all DB2 UDB tables, views, indexes, tablespaces and databases which are contained in the specified DB2 UDB 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:  DAQDB2csPhysicalDesign
  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. --DA_DB2udbPhysicalDesignContents
  19. SELECT
  20.   d.db2csPhysicalDesign,
  21.   t.db2csTable as objectName,
  22.   'Table' as partType,
  23.   p.lastUpdate,
  24.   p.addDate
  25. FROM OUTER
  26.   DAQDB2csPhysicalDesign d,
  27.   (d.db2csTable) t,
  28.   PartView p
  29. WHERE
  30.   d.db2csPhysicalDesign LIKE '<>%:%' AND
  31.   t.db2csTable=p.baseName
  32. UNION
  33. SELECT
  34.   d.db2csPhysicalDesign,
  35.   ts.db2csTablespace as objectName,
  36.   'Tablespace' as partType,
  37.   p.lastUpdate,
  38.   p.addDate
  39. FROM OUTER
  40.   DAQDB2csPhysicalDesign d,
  41.   (d.db2csTablespace) ts,
  42.   PartView p
  43. WHERE
  44.   d.db2csPhysicalDesign LIKE '<>%:%' AND
  45.   ts.db2csTablespace=p.baseName
  46. UNION
  47. SELECT
  48.   d.db2csPhysicalDesign,
  49.   v.db2csView as objectName,
  50.   'View' as partType,
  51.   p.lastUpdate,
  52.   p.addDate
  53. FROM OUTER
  54.   DAQDB2csPhysicalDesign d,
  55.   (d.db2csView) v,
  56.   PartView p
  57. WHERE
  58.   d.db2csPhysicalDesign LIKE '<>%:%' AND
  59.   v.db2csView=p.baseName
  60. UNION
  61. SELECT
  62.   d.db2csPhysicalDesign,
  63.   i.db2csIndex as objectName,
  64.   'Index' as partType,
  65.   p.lastUpdate,
  66.   p.addDate
  67. FROM OUTER
  68.   DAQDB2csPhysicalDesign d,
  69.   (d.db2csIndex) i,
  70.   PartView p
  71. WHERE
  72.   d.db2csPhysicalDesign LIKE '<>%:%' AND
  73.   i.db2csIndex=p.baseName
  74. UNION
  75. SELECT
  76.   d.db2csPhysicalDesign,
  77.   db.db2csDatabase as objectName,
  78.   'Database' as partType,
  79.   p.lastUpdate,
  80.   p.addDate
  81. FROM OUTER
  82.   DAQDB2csPhysicalDesign d,
  83.   (d.db2csDatabase) db,
  84.   PartView p
  85. WHERE
  86.   d.db2csPhysicalDesign LIKE '<>%:%' AND
  87.   db.db2csDatabase=p.baseName
  88. ORDER BY 4 DESC;
  89.