

CREATE VIEW DAQMSDBDBD AS 
  SELECT 
   a.*,
   e.dataStructure AS adName5,
   e.structureAlias AS adName6,
   e.usesDataElement AS adName7,
   e.usesDataStructure AS adName8,
   h.dataElement AS adName9,
   h.elementAlias AS adName10,
   h.asBitData AS asBitData2,
   h.genericPicture AS genericPicture2,
   h.isComplex AS isComplex2,
   h.isSigned AS isSigned2,
   h.isLOB AS isLOB2,
   h.numericPrecision AS precision2,
   h.scale AS scale2,
   h.stringLength AS strLength2,
   h.stringVaryingCode AS strVaryingFlag2,
   h.typeCode AS typeCode2,
   h.vagSignFormat,
   h.elementDescription AS contents3,
   h.elementDescType AS label3,
   k.dataStructure AS adName11,
   k.structureAlias AS adName12,
   k.usesDataElement AS adName13,
   k.usesDataStructure AS adName14,
   n.dataElement AS adName15,
   n.elementAlias AS adName16,
   n.asBitData AS asBitData3,
   n.genericPicture AS genericPicture3,
   n.isComplex AS isComplex3,
   n.isSigned AS isSigned3,
   n.isLOB AS isLOB3,
   n.numericPrecision AS precision3,
   n.scale AS scale3,
   n.stringLength AS strLength3,
   n.stringVaryingCode AS strVaryingFlag3,
   n.typeCode AS typeCode3,
   n.vagSignFormat AS vgSignFormat1,
   n.elementDescription AS contents4,
   n.elementDescType AS label4
  FROM
    DAQMSDBDBDBase a
    INNER JOIN DSDataItem b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind c ON c.OID=b.pSharedDataDef AND
       c.className='DSLinkDataItm2SDD' AND
       c.contextRelease=a.contextRelease AND c.contextName=a.contextName
    LEFT OUTER JOIN ADLink d ON d.OID=c.OID AND d.OVer=c.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE e ON e.OID=d.adTarget AND e.OVer=d.OVer    
AND  e.contextRelease=a.contextRelease AND  e.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind f ON f.OID=b.pSharedDataDef AND
       f.className='DSLinkDataItm2SDD' AND
       f.contextRelease=a.contextRelease AND f.contextName=a.contextName
    LEFT OUTER JOIN ADLink g ON g.OID=f.OID AND g.OVer=f.OVer
    LEFT OUTER JOIN DAQDATAELEMENT h ON h.OID=g.adTarget AND h.OVer=g.OVer    
AND  h.contextRelease=a.contextRelease AND  h.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind i ON i.OID=b.pSharedDataDef AND
       i.className='DSLinkDataItm2SDD' AND
       i.contextRelease=a.contextRelease AND i.contextName=a.contextName
    LEFT OUTER JOIN ADLink j ON j.OID=i.OID AND j.OVer=i.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE k ON k.OID=j.adTarget AND k.OVer=j.OVer    
AND  k.contextRelease=a.contextRelease AND  k.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind l ON l.OID=b.pSharedDataDef AND
       l.className='DSLinkDataItm2SDD' AND
       l.contextRelease=a.contextRelease AND l.contextName=a.contextName
    LEFT OUTER JOIN ADLink m ON m.OID=l.OID AND m.OVer=l.OVer
    LEFT OUTER JOIN DAQDATAELEMENT n ON n.OID=m.adTarget AND n.OVer=m.OVer    
AND  n.contextRelease=a.contextRelease AND  n.contextName=a.contextName;

CREATE VIEW DAQHSAMDBD AS 
  SELECT 
   a.*,
   e.dataStructure AS adName14,
   e.structureAlias AS adName15,
   e.usesDataElement AS adName16,
   e.usesDataStructure AS adName17,
   h.dataElement AS adName18,
   h.elementAlias AS adName19,
   h.asBitData AS asBitData1,
   h.genericPicture AS genericPicture1,
   h.isComplex AS isComplex1,
   h.isSigned AS isSigned1,
   h.isLOB AS isLOB1,
   h.numericPrecision AS precision1,
   h.scale AS scale1,
   h.stringLength AS strLength1,
   h.stringVaryingCode AS strVaryingFlag1,
   h.typeCode AS typeCode1,
   h.vagSignFormat,
   h.elementDescription AS contents3,
   h.elementDescType AS label3,
   l.dataStructure AS adName20,
   l.structureAlias AS adName21,
   l.usesDataElement AS adName22,
   l.usesDataStructure AS adName23
  FROM
    DAQHSAMDBDBase a
    INNER JOIN DSDataItem b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind c ON c.OID=b.pSharedDataDef AND
       c.className='DSLinkDataItm2SDD' AND
       c.contextRelease=a.contextRelease AND c.contextName=a.contextName
    LEFT OUTER JOIN ADLink d ON d.OID=c.OID AND d.OVer=c.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE e ON e.OID=d.adTarget AND e.OVer=d.OVer    
AND  e.contextRelease=a.contextRelease AND  e.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind f ON f.OID=b.pSharedDataDef AND
       f.className='DSLinkDataItm2SDD' AND
       f.contextRelease=a.contextRelease AND f.contextName=a.contextName
    LEFT OUTER JOIN ADLink g ON g.OID=f.OID AND g.OVer=f.OVer
    LEFT OUTER JOIN DAQDATAELEMENT h ON h.OID=g.adTarget AND h.OVer=g.OVer    
AND  h.contextRelease=a.contextRelease AND  h.contextName=a.contextName
    INNER JOIN DSSegment i ON i.OID=a.OID AND i.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind j ON j.OID=i.mappingStructure AND
       j.className='DSMappedBy' AND
       j.contextRelease=a.contextRelease AND j.contextName=a.contextName
    LEFT OUTER JOIN ADLink k ON k.OID=j.OID AND k.OVer=j.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE l ON l.OID=k.adTarget AND l.OVer=k.OVer    
AND  l.contextRelease=a.contextRelease AND  l.contextName=a.contextName;

CREATE VIEW DAQDEDBDBD AS 
  SELECT 
   a.*,
   e.dataStructure AS adName14,
   e.structureAlias AS adName15,
   e.usesDataElement AS adName16,
   e.usesDataStructure AS adName17,
   h.dataElement AS adName18,
   h.elementAlias AS adName19,
   h.asBitData AS asBitData1,
   h.genericPicture AS genericPicture1,
   h.isComplex AS isComplex1,
   h.isSigned AS isSigned1,
   h.isLOB AS isLOB1,
   h.numericPrecision AS precision1,
   h.scale AS scale1,
   h.stringLength AS strLength1,
   h.stringVaryingCode AS strVaryingFlag1,
   h.typeCode AS typeCode1,
   h.vagSignFormat,
   h.elementDescription AS contents3,
   h.elementDescType AS label3,
   l.dataStructure AS adName20,
   l.structureAlias AS adName21,
   l.usesDataElement AS adName22,
   l.usesDataStructure AS adName23
  FROM
    DAQDEDBDBDBase a
    INNER JOIN DSDataItem b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind c ON c.OID=b.pSharedDataDef AND
       c.className='DSLinkDataItm2SDD' AND
       c.contextRelease=a.contextRelease AND c.contextName=a.contextName
    LEFT OUTER JOIN ADLink d ON d.OID=c.OID AND d.OVer=c.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE e ON e.OID=d.adTarget AND e.OVer=d.OVer    
AND  e.contextRelease=a.contextRelease AND  e.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind f ON f.OID=b.pSharedDataDef AND
       f.className='DSLinkDataItm2SDD' AND
       f.contextRelease=a.contextRelease AND f.contextName=a.contextName
    LEFT OUTER JOIN ADLink g ON g.OID=f.OID AND g.OVer=f.OVer
    LEFT OUTER JOIN DAQDATAELEMENT h ON h.OID=g.adTarget AND h.OVer=g.OVer    
AND  h.contextRelease=a.contextRelease AND  h.contextName=a.contextName
    INNER JOIN DSSegment i ON i.OID=a.OID AND i.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind j ON j.OID=i.mappingStructure AND
       j.className='DSMappedBy' AND
       j.contextRelease=a.contextRelease AND j.contextName=a.contextName
    LEFT OUTER JOIN ADLink k ON k.OID=j.OID AND k.OVer=j.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE l ON l.OID=k.adTarget AND l.OVer=k.OVer    
AND  l.contextRelease=a.contextRelease AND  l.contextName=a.contextName;

CREATE VIEW DAQINDEXDBD AS 
  SELECT 
   a.*,
   e.dataStructure AS adName23,
   e.structureAlias AS adName24,
   e.usesDataElement AS adName25,
   e.usesDataStructure AS adName26,
   h.dataElement AS adName27,
   h.elementAlias AS adName28,
   h.asBitData AS asBitData1,
   h.genericPicture AS genericPicture1,
   h.isComplex AS isComplex1,
   h.isSigned AS isSigned1,
   h.isLOB AS isLOB1,
   h.numericPrecision AS precision1,
   h.scale AS scale1,
   h.stringLength AS strLength1,
   h.stringVaryingCode AS strVaryingFlag1,
   h.typeCode AS typeCode1,
   h.vagSignFormat,
   h.elementDescription AS contents3,
   h.elementDescType AS label3,
   l.dataStructure AS adName29,
   l.structureAlias AS adName30,
   l.usesDataElement AS adName31,
   l.usesDataStructure AS adName32
  FROM
    DAQINDEXDBDBase a
    INNER JOIN DSDataItem b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind c ON c.OID=b.pSharedDataDef AND
       c.className='DSLinkDataItm2SDD' AND
       c.contextRelease=a.contextRelease AND c.contextName=a.contextName
    LEFT OUTER JOIN ADLink d ON d.OID=c.OID AND d.OVer=c.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE e ON e.OID=d.adTarget AND e.OVer=d.OVer    
AND  e.contextRelease=a.contextRelease AND  e.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind f ON f.OID=b.pSharedDataDef AND
       f.className='DSLinkDataItm2SDD' AND
       f.contextRelease=a.contextRelease AND f.contextName=a.contextName
    LEFT OUTER JOIN ADLink g ON g.OID=f.OID AND g.OVer=f.OVer
    LEFT OUTER JOIN DAQDATAELEMENT h ON h.OID=g.adTarget AND h.OVer=g.OVer    
AND  h.contextRelease=a.contextRelease AND  h.contextName=a.contextName
    INNER JOIN DSSegment i ON i.OID=a.OID AND i.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind j ON j.OID=i.mappingStructure AND
       j.className='DSMappedBy' AND
       j.contextRelease=a.contextRelease AND j.contextName=a.contextName
    LEFT OUTER JOIN ADLink k ON k.OID=j.OID AND k.OVer=j.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE l ON l.OID=k.adTarget AND l.OVer=k.OVer    
AND  l.contextRelease=a.contextRelease AND  l.contextName=a.contextName;

CREATE VIEW DAQDBDUSAGE AS 
  SELECT 
   a.*,
   f.dataStructure AS adName17,
   f.structureAlias AS adName18,
   f.usesDataElement AS adName19,
   f.usesDataStructure AS adName20,
   j.dataElement AS adName21,
   j.elementAlias AS adName22,
   j.asBitData,
   j.genericPicture,
   j.isComplex,
   j.isSigned,
   j.isLOB,
   j.numericPrecision,
   j.scale,
   j.stringLength,
   j.stringVaryingCode,
   j.typeCode,
   j.vagSignFormat,
   j.elementDescription,
   j.elementDescType,
   n.structureAlias AS adName23,
   n.structureName AS adName24,
   q.structureAlias AS adName25,
   q.structureName AS adName26,
   t.structureAlias AS adName27,
   t.structureName AS adName28,
   w.structureAlias AS adName29,
   w.structureName AS adName30,
   z.structureAlias AS adName31,
   z.structureName AS adName32,
   ac.structureAlias AS adName33,
   ac.structureName AS adName34,
   af.structureAlias AS adName35,
   af.structureName AS adName36,
   ai.structureAlias AS adName37,
   ai.structureName AS adName38,
   al.structureAlias AS adName39,
   al.structureName AS adName40,
   ao.structureAlias AS adName41,
   ao.structureName AS adName42,
   ar.structureAlias AS adName43,
   ar.structureName AS adName44,
   av.structureAlias AS adName45,
   av.structureName AS adName46,
   ay.structureAlias AS adName47,
   ay.structureName AS adName48,
   bb.structureAlias AS adName49,
   bb.structureName AS adName50
  FROM
    DAQDBDUSAGEBase a
    INNER JOIN FHCVersion b ON b.OID=a.OID AND b.OVer=a.OVer
    LEFT OUTER JOIN ADLink_source c ON c.classAttr='DSDBD_version.dependsOn' AND
      c.sourceOID=b.OID AND c.sourceOVer=b.OVer
    LEFT OUTER JOIN adobjectFind d ON d.OID=c.relOID AND d.OVer=c.relOVer AND
       d.className='ADLinkTCPartDependsOnTCPart' AND
       d.contextRelease=a.contextRelease AND d.contextName=a.contextName
    LEFT OUTER JOIN ADLink e ON e.OID=d.OID AND e.OVer=d.OVer
    LEFT OUTER JOIN DAQDATASTRUCTURE f ON f.OID=e.adTarget AND f.OVer=e.OVer    
AND  f.contextRelease=a.contextRelease AND  f.contextName=a.contextName
    LEFT OUTER JOIN ADLink_source g ON g.classAttr='DSDBD_version.dependsOn' AND
      g.sourceOID=b.OID AND g.sourceOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='ADLinkTCPartDependsOnTCPart' AND
       h.contextRelease=a.contextRelease AND h.contextName=a.contextName
    LEFT OUTER JOIN ADLink i ON i.OID=h.OID AND i.OVer=h.OVer
    LEFT OUTER JOIN DAQDATAELEMENT j ON j.OID=i.adTarget AND j.OVer=i.OVer    
AND  j.contextRelease=a.contextRelease AND  j.contextName=a.contextName
    INNER JOIN DSSegment k ON k.OID=a.OID AND k.OVer=a.OVer
    LEFT OUTER JOIN adobjectFind l ON l.OID=k.segmName AND
       l.className='DSHasIMSsegmName' AND
       l.contextRelease=a.contextRelease AND l.contextName=a.contextName
    LEFT OUTER JOIN ADLink m ON m.OID=l.OID AND m.OVer=l.OVer
    LEFT OUTER JOIN DAQDSALIAS n ON n.OID=m.adTarget AND n.OVer=m.OVer    
AND  n.contextRelease=a.contextRelease AND  n.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind o ON o.OID=k.segmName AND
       o.className='DSHasIMSsegmName' AND
       o.contextRelease=a.contextRelease AND o.contextName=a.contextName
    LEFT OUTER JOIN ADLink p ON p.OID=o.OID AND p.OVer=o.OVer
    LEFT OUTER JOIN DAQDSALIAS q ON q.OID=p.adTarget AND q.OVer=p.OVer    
AND  q.contextRelease=a.contextRelease AND  q.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind r ON r.OID=k.segmName AND
       r.className='DSHasIMSsegmName' AND
       r.contextRelease=a.contextRelease AND r.contextName=a.contextName
    LEFT OUTER JOIN ADLink s ON s.OID=r.OID AND s.OVer=r.OVer
    LEFT OUTER JOIN DAQDSALIAS t ON t.OID=s.adTarget AND t.OVer=s.OVer    
AND  t.contextRelease=a.contextRelease AND  t.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind u ON u.OID=k.segmName AND
       u.className='DSHasIMSsegmName' AND
       u.contextRelease=a.contextRelease AND u.contextName=a.contextName
    LEFT OUTER JOIN ADLink v ON v.OID=u.OID AND v.OVer=u.OVer
    LEFT OUTER JOIN DAQDSALIAS w ON w.OID=v.adTarget AND w.OVer=v.OVer    
AND  w.contextRelease=a.contextRelease AND  w.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind x ON x.OID=k.segmName AND
       x.className='DSHasIMSsegmName' AND
       x.contextRelease=a.contextRelease AND x.contextName=a.contextName
    LEFT OUTER JOIN ADLink y ON y.OID=x.OID AND y.OVer=x.OVer
    LEFT OUTER JOIN DAQDSALIAS z ON z.OID=y.adTarget AND z.OVer=y.OVer    
AND  z.contextRelease=a.contextRelease AND  z.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind aa ON aa.OID=k.segmName AND
       aa.className='DSHasIMSsegmName' AND
       aa.contextRelease=a.contextRelease AND aa.contextName=a.contextName
    LEFT OUTER JOIN ADLink ab ON ab.OID=aa.OID AND ab.OVer=aa.OVer
    LEFT OUTER JOIN DAQDSALIAS ac ON ac.OID=ab.adTarget AND ac.OVer=ab.OVer    
AND  ac.contextRelease=a.contextRelease AND  ac.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind ad ON ad.OID=k.segmName AND
       ad.className='DSHasIMSsegmName' AND
       ad.contextRelease=a.contextRelease AND ad.contextName=a.contextName
    LEFT OUTER JOIN ADLink ae ON ae.OID=ad.OID AND ae.OVer=ad.OVer
    LEFT OUTER JOIN DAQDSALIAS af ON af.OID=ae.adTarget AND af.OVer=ae.OVer    
AND  af.contextRelease=a.contextRelease AND  af.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind ag ON ag.OID=k.segmName AND
       ag.className='DSHasIMSsegmName' AND
       ag.contextRelease=a.contextRelease AND ag.contextName=a.contextName
    LEFT OUTER JOIN ADLink ah ON ah.OID=ag.OID AND ah.OVer=ag.OVer
    LEFT OUTER JOIN DAQDSALIAS ai ON ai.OID=ah.adTarget AND ai.OVer=ah.OVer    
AND  ai.contextRelease=a.contextRelease AND  ai.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind aj ON aj.OID=k.segmName AND
       aj.className='DSHasIMSsegmName' AND
       aj.contextRelease=a.contextRelease AND aj.contextName=a.contextName
    LEFT OUTER JOIN ADLink ak ON ak.OID=aj.OID AND ak.OVer=aj.OVer
    LEFT OUTER JOIN DAQDSALIAS al ON al.OID=ak.adTarget AND al.OVer=ak.OVer    
AND  al.contextRelease=a.contextRelease AND  al.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind am ON am.OID=k.segmName AND
       am.className='DSHasIMSsegmName' AND
       am.contextRelease=a.contextRelease AND am.contextName=a.contextName
    LEFT OUTER JOIN ADLink an ON an.OID=am.OID AND an.OVer=am.OVer
    LEFT OUTER JOIN DAQDSALIAS ao ON ao.OID=an.adTarget AND ao.OVer=an.OVer    
AND  ao.contextRelease=a.contextRelease AND  ao.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind ap ON ap.OID=k.segmName AND
       ap.className='DSHasIMSsegmName' AND
       ap.contextRelease=a.contextRelease AND ap.contextName=a.contextName
    LEFT OUTER JOIN ADLink aq ON aq.OID=ap.OID AND aq.OVer=ap.OVer
    LEFT OUTER JOIN DAQDSALIAS ar ON ar.OID=aq.adTarget AND ar.OVer=aq.OVer    
AND  ar.contextRelease=a.contextRelease AND  ar.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind at ON at.OID=k.segmName AND
       at.className='DSHasIMSsegmName' AND
       at.contextRelease=a.contextRelease AND at.contextName=a.contextName
    LEFT OUTER JOIN ADLink au ON au.OID=at.OID AND au.OVer=at.OVer
    LEFT OUTER JOIN DAQDSALIAS av ON av.OID=au.adTarget AND av.OVer=au.OVer    
AND  av.contextRelease=a.contextRelease AND  av.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind aw ON aw.OID=k.segmName AND
       aw.className='DSHasIMSsegmName' AND
       aw.contextRelease=a.contextRelease AND aw.contextName=a.contextName
    LEFT OUTER JOIN ADLink ax ON ax.OID=aw.OID AND ax.OVer=aw.OVer
    LEFT OUTER JOIN DAQDSALIAS ay ON ay.OID=ax.adTarget AND ay.OVer=ax.OVer    
AND  ay.contextRelease=a.contextRelease AND  ay.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind az ON az.OID=k.segmName AND
       az.className='DSHasIMSsegmName' AND
       az.contextRelease=a.contextRelease AND az.contextName=a.contextName
    LEFT OUTER JOIN ADLink ba ON ba.OID=az.OID AND ba.OVer=az.OVer
    LEFT OUTER JOIN DAQDSALIAS bb ON bb.OID=ba.adTarget AND bb.OVer=ba.OVer    
AND  bb.contextRelease=a.contextRelease AND  bb.contextName=a.contextName;