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

  1. #NAME#
  2. DA_DB2udbDatabaseContents
  3. #DESCRIPTION#
  4. The database contents relationship query returns the name of the DB2 UDB tables, views, and indexes which are referenced by the specified database name.  The rows are ordered by descending time of the last update so you may use this query to help determine what has changed and may need to have DDL generated.
  5.  
  6. View type: DAQDB2csDatabase
  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 database name using the = (equals), IN or LIKE elements in the SQL WHERE clause.
  10. #MODIFIED#
  11.  
  12. #VERSION#
  13.  
  14. #SQL STATEMENT#
  15. --DA_DB2udbDatabaseContents
  16. SELECT
  17.   d.db2csDatabase,
  18.   d.inRelationalSystem..relationalSystem,
  19.   d.inPhysicalDesign..db2csPhysicalDesign,
  20.   d.containsTable..db2csTable as databaseContent,
  21.   'Table' as partType,
  22.   p.lastUpdate,
  23.   p.addDate
  24. FROM OUTER
  25.   DAQDB2csDatabase d,
  26.   PartView p
  27. WHERE
  28.   d.db2csDatabase LIKE '<>%' AND
  29.   d.containsTable..db2csTable=p.baseName AND
  30.   p.partType='DSRORDTable'
  31. UNION
  32. SELECT
  33.   d.db2csDatabase,
  34.   d.inRelationalSystem..relationalSystem,
  35.   d.inPhysicalDesign..db2csPhysicalDesign,
  36.   d.containsView..db2csView as databaseContent,
  37.   'View' as partType,
  38.   p.lastUpdate,
  39.   p.addDate
  40. FROM OUTER
  41.   DAQDB2csDatabase d,
  42.   PartView p
  43. WHERE
  44.   d.db2csDatabase LIKE '<>%' AND
  45.   d.containsView..db2csView=p.baseName AND
  46.   p.partType='DSRORDView'
  47. UNION
  48. SELECT
  49.   d.db2csDatabase,
  50.   d.inRelationalSystem..relationalSystem,
  51.   d.inPhysicalDesign..db2csPhysicalDesign,
  52.   d.containsIndex..db2csIndex as databaseContent,
  53.   'Index' as partType,
  54.   p.lastUpdate,
  55.   p.addDate
  56. FROM OUTER
  57.   DAQDB2csDatabase d,
  58.   PartView p
  59. WHERE
  60.   d.db2csDatabase LIKE '<>%' AND
  61.   d.containsIndex..db2csIndex=p.baseName AND
  62.   p.partType='DSRORDIndex'
  63. ORDER BY 
  64.   1 ASC,
  65.   6 DESC;
  66.