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

  1. #NAME#
  2. DA_RelationalSystemContents
  3. #DESCRIPTION#
  4. The RelationalSystemContents relationship query returns the names of all DB2/390 objects, all DB2 UDB objects or all Oracle objects which are contained in the specified Relational Database System.
  5.  
  6. View type:  DAQRelationalSystem
  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 relationalSystem using the = (equals), IN or LIKE elements in the SQL WHERE clause.  The WHERE clause may be changed to locate the Relational System which contains a specified relational database object by specifying the object name for the appropriate attribute.
  10.  
  11. The name format for the relational objects is specified in DataAtlas User's Guide.
  12.  
  13. #MODIFIED#
  14.  
  15. #VERSION#
  16.  
  17. #SQL STATEMENT#
  18. --DA_RelationalSystemContents
  19. SELECT DISTINCT
  20.   r.relationalSystem,
  21.   r.rdbProductName as product, 
  22.   r.rdbProductVersion as version,
  23.   r.creatorID as relatedObject,
  24.   'Creator/Schema' as partType,
  25.   p.lastUpdate,
  26.   p.addDate
  27. FROM OUTER
  28.   DAQRelationalSystem r,
  29.   PartView p
  30. WHERE
  31.   r.relationalSystem like '<>%' AND
  32.   r.creatorID=p.baseName AND
  33.   p.partType='DSRRCollection'
  34. UNION
  35. SELECT DISTINCT
  36.   r.relationalSystem,
  37.   r.rdbProductName as product, 
  38.   r.rdbProductVersion as version,
  39.   r.db2csTable..db2csTable as relatedObject,
  40.   'DB2 UDB Table' as partType,
  41.   p.lastUpdate,
  42.   p.addDate
  43. FROM OUTER
  44.   DAQRelationalSystem r,
  45.   PartView p
  46. WHERE
  47.   r.relationalSystem like '<>%' AND
  48.   r.db2csTable..db2csTable=p.baseName AND
  49.   p.partType='DSRORDTable'
  50. UNION
  51. SELECT DISTINCT
  52.   r.relationalSystem,
  53.   r.rdbProductName as product,
  54.   r.rdbProductVersion as version,
  55.   r.db2csView..db2csView as relatedObject,
  56.   'DB2 UDB View' as partType,
  57.   p.lastUpdate,
  58.   p.addDate
  59. FROM OUTER
  60.   DAQRelationalSystem r,
  61.   PartView p
  62. WHERE
  63.   r.relationalSystem like '<>%' AND
  64.   r.db2csView..db2csView=p.baseName AND
  65.   p.partType='DSRORDView'
  66. UNION
  67. SELECT DISTINCT
  68.   r.relationalSystem,
  69.   r.rdbProductName as product,
  70.   r.rdbProductVersion as version,
  71.   r.db2csIndex..db2csIndex as relatedObject,
  72.   'DB2 UDB Index' as partType,
  73.   p.lastUpdate,
  74.   p.addDate
  75. FROM OUTER
  76.   DAQRelationalSystem r,
  77.   PartView p
  78. WHERE
  79.   r.relationalSystem like '<>%' AND
  80.   r.db2csIndex..db2csIndex=p.baseName AND
  81.   p.partType='DSRORDIndex'
  82. UNION
  83. SELECT DISTINCT
  84.   r.relationalSystem,
  85.   r.rdbProductName as product,
  86.   r.rdbProductVersion as version,
  87.   r.db2csTablespace..db2csTablespace as relatedObject,
  88.   'DB2 UDB Tablespace' as partType,
  89.   p.lastUpdate,
  90.   p.addDate
  91. FROM OUTER
  92.   DAQRelationalSystem r,
  93.   PartView p
  94. WHERE
  95.   r.relationalSystem like '<>%' AND
  96.   r.db2csTablespace..db2csTablespace=p.baseName AND
  97.   p.partType='DSRORDTablespace'
  98. UNION
  99. SELECT DISTINCT
  100.   r.relationalSystem,
  101.   r.rdbProductName as product,
  102.   r.rdbProductVersion as version,
  103.   r.db2csDatabase..db2csDatabase as relatedObject,
  104.   'DB2 UDB Database' as partType,
  105.   p.lastUpdate,
  106.   p.addDate
  107. FROM OUTER
  108.   DAQRelationalSystem r,
  109.   PartView p
  110. WHERE
  111.   r.relationalSystem like '<>%' AND
  112.   r.db2csDatabase..db2csDatabase=p.baseName AND
  113.   p.partType='DSRORDDatabase'
  114. UNION
  115. SELECT DISTINCT
  116.   r.relationalSystem,
  117.   r.rdbProductName as product,
  118.   r.rdbProductVersion as version,
  119.   r.db2390Table..db2390Table as relatedObject,
  120.   'DB2/390 Table' as partType,
  121.   p.lastUpdate,
  122.   p.addDate
  123. FROM OUTER
  124.   DAQRelationalSystem r,
  125.   PartView p
  126. WHERE
  127.   r.relationalSystem like '<>%' AND
  128.   r.db2390Table..db2390Table=p.baseName AND
  129.   p.partType='DSRMRDTable'
  130. UNION
  131. SELECT DISTINCT
  132.   r.relationalSystem,
  133.   r.rdbProductName as product,
  134.   r.rdbProductVersion as version,
  135.   r.db2390View..db2390View as relatedObject,
  136.   'DB2/390 View' as partType,
  137.   p.lastUpdate,
  138.   p.addDate
  139. FROM OUTER
  140.   DAQRelationalSystem r,
  141.   PartView p
  142. WHERE
  143.   r.relationalSystem like '<>%' AND
  144.   r.db2390View..db2390View=p.baseName AND
  145.   p.partType='DSRMRDView'
  146. UNION
  147. SELECT DISTINCT
  148.   r.relationalSystem,
  149.   r.rdbProductName as product, 
  150.   r.rdbProductVersion as version,
  151.   r.db2390Index..db2390Index as relatedObject,
  152.   'DB2/390 Index' as partType,
  153.   p.lastUpdate,
  154.   p.addDate
  155. FROM OUTER
  156.   DAQRelationalSystem r,
  157.   PartView p
  158. WHERE
  159.   r.relationalSystem like '<>%' AND
  160.   r.db2390Index..db2390Index=p.baseName AND
  161.   p.partType='DSRMRDIndex'
  162. UNION
  163. SELECT DISTINCT
  164.   r.relationalSystem,
  165.   r.rdbProductName as product,
  166.   r.rdbProductVersion as version,
  167.   r.db2390Tablespace..db2390Tablespace as relatedObject,
  168.   'DB2/390 Tablespace' as partType,
  169.   p.lastUpdate,
  170.   p.addDate
  171. FROM OUTER
  172.   DAQRelationalSystem r,
  173.   PartView p
  174. WHERE
  175.   r.relationalSystem like '<>%' AND
  176.   r.db2390Tablespace..db2390Tablespace=p.baseName AND
  177.   p.partType='DSRMRDTablespace'
  178. UNION
  179. SELECT DISTINCT
  180.   r.relationalSystem,
  181.   r.rdbProductName as product,
  182.   r.rdbProductVersion as version,
  183.   r.db2390Database..db2390Database as relatedObject,
  184.   'DB2/390 Database' as partType,
  185.   p.lastUpdate,
  186.   p.addDate
  187. FROM OUTER
  188.   DAQRelationalSystem r,
  189.   PartView p
  190. WHERE
  191.   r.relationalSystem like '<>%' AND
  192.   r.db2390Database..db2390Database=p.baseName AND
  193.   p.partType='DSRMRDDatabase'
  194. UNION
  195. SELECT DISTINCT
  196.   r.relationalSystem,
  197.   r.rdbProductName as product,
  198.   r.rdbProductVersion as version,
  199.   r.db2390AliasSynonym..db2390AliasOrSynonym as relatedObject,
  200.   'DB2/390 Alias/Synonym' as partType,
  201.   p.lastUpdate,
  202.   p.addDate
  203. FROM OUTER
  204.   DAQRelationalSystem r,
  205.   PartView p
  206. WHERE
  207.   r.relationalSystem like '<>%' AND
  208.   r.db2390AliasSynonym..db2390AliasOrSynonym=p.baseName AND
  209.   p.partType='DSRAlternateName'
  210. UNION
  211. SELECT DISTINCT
  212.   r.relationalSystem,
  213.   r.rdbProductName as product,
  214.   r.rdbProductVersion as version,
  215.   r.db2390StorageGroup..db2390StorageGroup as relatedObject,
  216.   'DB2/390 Storage Group' as partType,
  217.   p.lastUpdate,
  218.   p.addDate
  219. FROM OUTER
  220.   DAQRelationalSystem r,
  221.   PartView p
  222. WHERE
  223.   r.relationalSystem like '<>%' AND
  224.   r.db2390StorageGroup..db2390StorageGroup=p.baseName AND
  225.   p.partType='DSRMRDStorageGroup'
  226. UNION
  227. SELECT DISTINCT
  228.   r.relationalSystem,
  229.   r.rdbProductName as product,
  230.   r.rdbProductVersion as version,
  231.   r.db2390Bufferpool..db2390Bufferpool as relatedObject,
  232.   'DB2/390 Bufferpool' as partType,
  233.   p.lastUpdate,
  234.   p.addDate
  235. FROM OUTER
  236.   DAQRelationalSystem r,
  237.   PartView p
  238. WHERE
  239.   r.relationalSystem like '<>%' AND
  240.   r.db2390Bufferpool..db2390Bufferpool=p.baseName AND
  241.   p.partType='DSRMRDBufferpool'
  242. UNION
  243. SELECT DISTINCT
  244.   r.relationalSystem,
  245.   r.rdbProductName as product,
  246.   r.rdbProductVersion as version,
  247.   r.oracleTable..oracleTable as relatedObject,
  248.   'Oracle Table' as partType,
  249.   p.lastUpdate,
  250.   p.addDate
  251. FROM OUTER
  252.   DAQRelationalSystem r,
  253.   PartView p
  254. WHERE
  255.   r.relationalSystem like '<>%' AND
  256.   r.oracleTable..oracleTable=p.baseName AND
  257.   p.partType='DSROracleTable'
  258. UNION
  259. SELECT DISTINCT
  260.   r.relationalSystem,
  261.   r.rdbProductName as product,
  262.   r.rdbProductVersion as version,
  263.   r.oracleView..oracleView as relatedObject,
  264.   'Oracle View' as partType,
  265.   p.lastUpdate,
  266.   p.addDate
  267. FROM OUTER
  268.   DAQRelationalSystem r,
  269.   PartView p
  270. WHERE
  271.   r.relationalSystem like '<>%' AND
  272.   r.oracleView..oracleView=p.baseName AND
  273.   p.partType='DSROracleView'
  274. UNION
  275. SELECT DISTINCT
  276.   r.relationalSystem,
  277.   r.rdbProductName as product,
  278.   r.rdbProductVersion as version,
  279.   r.oracleIndex..oracleIndex as relatedObject,
  280.   'OracleIndex' as partType,
  281.   p.lastUpdate,
  282.   p.addDate
  283. FROM OUTER
  284.   DAQRelationalSystem r,
  285.   PartView p
  286. WHERE
  287.   r.relationalSystem like '<>%' AND
  288.   r.oracleIndex..oracleIndex=p.baseName AND
  289.   p.partType='DSROracleIndex'
  290. UNION
  291. SELECT DISTINCT
  292.   r.relationalSystem,
  293.   r.rdbProductName as product,
  294.   r.rdbProductVersion as version,
  295.   r.oracleTablespace..oracleTablespace as relatedObject,
  296.   'Oracle Tablespace' as partType,
  297.   p.lastUpdate,
  298.   p.addDate
  299. FROM OUTER
  300.   DAQRelationalSystem r,
  301.   PartView p
  302. WHERE
  303.   r.relationalSystem like '<>%' AND
  304.   r.oracleTablespace..oracleTablespace=p.baseName AND
  305.   p.partType='DSROracleTablespace'
  306. ORDER BY
  307.   2 ASC,
  308.   3 ASC,
  309.   1 ASC,
  310.   5 ASC,
  311.   4 ASC;
  312.  
  313.