CREATE VIEW DAQDATASTRUCTURE AS 
  SELECT
    a.*,
    f.name as dataStructure,
    o.name as structureAlias,
    x.name as usesDataElement,
    ag.name as usesDataStructure
  FROM
    OIDOVers a
    INNER JOIN DSDataStructr_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    INNER JOIN FHCVersion c ON c.OID=b.OID AND c.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target g ON g.classAttr='DSDataStructure_version.aliases' AND
      g.targetOID=b.OID AND g.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='DSLinkDSAlias2DataStrc' 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 ADLink_source p ON p.classAttr='FHCVersion.dependsOn' AND
      p.sourceOID=c.OID AND p.sourceOVer=c.OVer
    LEFT OUTER JOIN adobjectFind q ON q.OID=p.relOID AND q.OVer=p.relOVer AND
       q.className='ADLinkTCPartDependsOnTCPart' AND
       q.contextRelease=a.contextRelease AND q.contextName=a.contextName
    LEFT OUTER JOIN ADLink r ON r.OID=q.OID AND r.OVer=q.OVer
    LEFT OUTER JOIN ADLink_source y ON y.classAttr='FHCVersion.dependsOn' AND
      y.sourceOID=c.OID AND y.sourceOVer=c.OVer
    LEFT OUTER JOIN adobjectFind z ON z.OID=y.relOID AND z.OVer=y.relOVer AND
       z.className='ADLinkTCPartDependsOnTCPart' AND
       z.contextRelease=a.contextRelease AND z.contextName=a.contextName
    LEFT OUTER JOIN ADLink aa ON aa.OID=z.OID AND aa.OVer=z.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers j ON j.OID=i.adSource AND  j.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass m ON m.OID=i.adSource AND m.OVer=i.OVer
    LEFT OUTER JOIN OIDOVers s ON s.OID=r.adTarget AND  s.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass v ON v.OID=r.adTarget AND v.OVer=r.OVer
    LEFT OUTER JOIN OIDOVers ab ON ab.OID=aa.adTarget AND  ab.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ae ON ae.OID=aa.adTarget AND ae.OVer=aa.OVer
    LEFT OUTER JOIN TCSourceObject n ON n.OID=m.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject w ON w.OID=v.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject af ON af.OID=ae.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath o ON o.OID=n.osrelNuPathId
    LEFT OUTER JOIN FHCPath x ON x.OID=w.osrelNuPathId
    LEFT OUTER JOIN FHCPath ag ON ag.OID=af.osrelNuPathId;

CREATE VIEW DAQDSALIASIMPACT AS 
  SELECT
    a.*,
    f.name as structureAlias,
    n.name as dataStructure,
    ag.name as usedByCoblDtStrctr,
    az.name as usedByDataStructur,
    bm.name as DBD
  FROM
    OIDOVers a
    INNER JOIN DSDtStrctrAls_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind g ON g.OID=b.pDataStructure AND
       g.className='DSLinkDSAlias2DataStrc' AND
       g.contextRelease=a.contextRelease AND g.contextName=a.contextName
    LEFT OUTER JOIN ADLink h ON h.OID=g.OID AND h.OVer=g.OVer
    LEFT OUTER JOIN ADLink_target ah ON ah.classAttr='DSSDDAlias_version.DILocalNames' AND
      ah.targetOID=b.OID AND ah.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind ai ON ai.OID=ah.relOID AND ai.OVer=ah.relOVer AND
       ai.className='DSLinkDataItm2SDDAlias' AND
       ai.contextRelease=a.contextRelease AND ai.contextName=a.contextName
    LEFT OUTER JOIN ADLink aj ON aj.OID=ai.OID AND aj.OVer=ai.OVer
    LEFT OUTER JOIN ADLink_target ba ON ba.classAttr='DSDataStructureAlias_version.segmNames' AND
      ba.targetOID=b.OID AND ba.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind bb ON bb.OID=ba.relOID AND bb.OVer=ba.relOVer AND
       bb.className='DSHasIMSsegmName' AND
       bb.contextRelease=a.contextRelease AND bb.contextName=a.contextName
    LEFT OUTER JOIN ADLink bc ON bc.OID=bb.OID AND bc.OVer=bb.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers i ON i.OID=h.adTarget AND  i.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass l ON l.OID=h.adTarget AND l.OVer=h.OVer
    LEFT OUTER JOIN adobjectFind ak ON ak.OID=aj.adSource AND
       ak.className='DSDataItem' AND
       ak.contextRelease=a.contextRelease AND ak.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind bd ON bd.OID=bc.adSource AND
       bd.className='DSSegment' AND
       bd.contextRelease=a.contextRelease AND bd.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject m ON m.OID=l.osrelTCSourceObjct
    LEFT OUTER JOIN DSDataComponent am ON am.OID=ak.OID AND am.OVer=ak.OVer
    LEFT OUTER JOIN DSSegment be ON be.OID=bd.OID AND be.OVer=bd.OVer
    LEFT OUTER JOIN FHCPath n ON n.OID=m.osrelNuPathId
    INNER JOIN ADObject o ON o.OID=b.OID AND o.OVer=b.OVer AND
     o.className='DSDataStructureAlias_version'
    LEFT OUTER JOIN adobjectFind an ON an.OID=am.pStructureDef AND
       an.className='DSLinkStrctDefComponent' AND
       an.contextRelease=a.contextRelease AND an.contextName=a.contextName
    LEFT OUTER JOIN ADLink ao ON ao.OID=an.OID AND ao.OVer=an.OVer
    LEFT OUTER JOIN adobjectFind bf ON bf.OID=be.containingDBD AND
       bf.className='DSContainsSegment' AND
       bf.contextRelease=a.contextRelease AND bf.contextName=a.contextName
    LEFT OUTER JOIN ADLink bg ON bg.OID=bf.OID AND bg.OVer=bf.OVer
    LEFT OUTER JOIN ADLink_target p ON p.classAttr='DSSDDAlias_version.DICobolNames' AND
      p.targetOID=o.OID AND p.targetOVer=o.OVer
    LEFT OUTER JOIN adobjectFind q ON q.OID=p.relOID AND q.OVer=p.relOVer AND
       q.className='DSLinkDataItm2SDDAlias1' AND
       q.contextRelease=a.contextRelease AND q.contextName=a.contextName
    LEFT OUTER JOIN ADLink r ON r.OID=q.OID AND r.OVer=q.OVer
    LEFT OUTER JOIN adobjectFind ap ON ap.OID=ao.adSource AND
       ap.className='DSStructureDef' AND
       ap.contextRelease=a.contextRelease AND ap.contextName=a.contextName
    LEFT OUTER JOIN OIDOVers bh ON bh.OID=bg.adSource AND  bh.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass bk ON bk.OID=bg.adSource AND bk.OVer=bg.OVer
    LEFT OUTER JOIN adobjectFind s ON s.OID=r.adSource AND
       s.className='DSDataItem' AND
       s.contextRelease=a.contextRelease AND s.contextName=a.contextName
    LEFT OUTER JOIN DSStructureDef aq ON aq.OID=ap.OID AND aq.OVer=ap.OVer
    LEFT OUTER JOIN TCSourceObject bl ON bl.OID=bk.osrelTCSourceObjct
    LEFT OUTER JOIN DSDataComponent u ON u.OID=s.OID AND u.OVer=s.OVer
    LEFT OUTER JOIN adobjectFind ar ON ar.OID=aq.pSharedStructure AND
       ar.className='DSLinkDataStrc2StrctDef' AND
       ar.contextRelease=a.contextRelease AND ar.contextName=a.contextName
    LEFT OUTER JOIN ADLink at ON at.OID=ar.OID AND at.OVer=ar.OVer
    LEFT OUTER JOIN FHCPath bm ON bm.OID=bl.osrelNuPathId
    LEFT OUTER JOIN adobjectFind v ON v.OID=u.pStructureDef AND
       v.className='DSLinkStrctDefComponent' AND
       v.contextRelease=a.contextRelease AND v.contextName=a.contextName
    LEFT OUTER JOIN ADLink w ON w.OID=v.OID AND w.OVer=v.OVer
    LEFT OUTER JOIN OIDOVers au ON au.OID=at.adSource AND  au.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ax ON ax.OID=at.adSource AND ax.OVer=at.OVer
    LEFT OUTER JOIN adobjectFind x ON x.OID=w.adSource AND
       x.className='DSStructureDef' AND
       x.contextRelease=a.contextRelease AND x.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject ay ON ay.OID=ax.osrelTCSourceObjct
    LEFT OUTER JOIN DSStructureDef y ON y.OID=x.OID AND y.OVer=x.OVer
    LEFT OUTER JOIN FHCPath az ON az.OID=ay.osrelNuPathId
    LEFT OUTER JOIN adobjectFind z ON z.OID=y.pSharedStructure AND
       z.className='DSLinkDataStrc2StrctDef' AND
       z.contextRelease=a.contextRelease AND z.contextName=a.contextName
    LEFT OUTER JOIN ADLink aa ON aa.OID=z.OID AND aa.OVer=z.OVer
    LEFT OUTER JOIN OIDOVers ab ON ab.OID=aa.adSource AND  ab.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ae ON ae.OID=aa.adSource AND ae.OVer=aa.OVer
    LEFT OUTER JOIN TCSourceObject af ON af.OID=ae.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath ag ON ag.OID=af.osrelNuPathId;

CREATE VIEW DAQDSIMPACT AS 
  SELECT
    a.*,
    f.name as structureName,
    s.name as IMSSegment,
    aa.name as DBD,
    aj.name as ShareableDatStrctr,
    at.name as IncludedSourceName,
    bc.name as primaryInclddSrcNm
  FROM
    OIDOVers a
    INNER JOIN DSDataStructr_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    INNER JOIN FHCVersion c ON c.OID=b.OID AND c.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target g ON g.classAttr='DSDataStructure_version.imsMappedSegments' AND
      g.targetOID=b.OID AND g.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='DSMappedBy' 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 ADLink_target ab ON ab.classAttr='FHCVersion.referencedBy' AND
      ab.targetOID=c.OID AND ab.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind ac ON ac.OID=ab.relOID AND ac.OVer=ab.relOVer AND
       ac.className='ADLinkTCPartDependsOnTCPart' AND
       ac.contextRelease=a.contextRelease AND ac.contextName=a.contextName
    LEFT OUTER JOIN ADLink ad ON ad.OID=ac.OID AND ad.OVer=ac.OVer
    LEFT OUTER JOIN ADLink_target au ON au.classAttr='FHCVersion.referencedBy' AND
      au.targetOID=c.OID AND au.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind av ON av.OID=au.relOID AND av.OVer=au.relOVer AND
       av.className='ADLinkTCPartDependsOnTCPart' AND
       av.contextRelease=a.contextRelease AND av.contextName=a.contextName
    LEFT OUTER JOIN ADLink aw ON aw.OID=av.OID AND aw.OVer=av.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN adobjectFind j ON j.OID=i.adSource AND
       j.className='DSSegment' AND
       j.contextRelease=a.contextRelease AND j.contextName=a.contextName
    LEFT OUTER JOIN OIDOVers ae ON ae.OID=ad.adSource AND  ae.contextOID=a.contextOID
    LEFT OUTER JOIN FHCVersion ag ON ag.OID=ad.adSource AND ag.OVer=ad.OVer
    LEFT OUTER JOIN TCVersionClass ah ON ah.OID=ad.OID AND ah.OVer=ad.OVer
    LEFT OUTER JOIN OIDOVers ax ON ax.OID=aw.adSource AND  ax.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ba ON ba.OID=aw.adSource AND ba.OVer=aw.OVer
    LEFT OUTER JOIN DSSegment k ON k.OID=j.OID AND k.OVer=j.OVer
    LEFT OUTER JOIN TCSourceObject ai ON ai.OID=ah.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target ak ON ak.classAttr='FHCVersion.referencedBy' AND
      ak.targetOID=ag.OID AND ak.targetOVer=ag.OVer
    LEFT OUTER JOIN adobjectFind al ON al.OID=ak.relOID AND al.OVer=ak.relOVer AND
       al.className='ADLinkTCPartDependsOnTCPart' AND
       al.contextRelease=a.contextRelease AND al.contextName=a.contextName
    LEFT OUTER JOIN ADLink am ON am.OID=al.OID AND am.OVer=al.OVer
    LEFT OUTER JOIN TCSourceObject bb ON bb.OID=ba.osrelTCSourceObjct
    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 adobjectFind t ON t.OID=k.containingDBD AND
       t.className='DSContainsSegment' AND
       t.contextRelease=a.contextRelease AND t.contextName=a.contextName
    LEFT OUTER JOIN ADLink u ON u.OID=t.OID AND u.OVer=t.OVer
    LEFT OUTER JOIN FHCPath aj ON aj.OID=ai.osrelNuPathId
    LEFT OUTER JOIN OIDOVers an ON an.OID=am.adSource AND  an.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass aq ON aq.OID=am.adSource AND aq.OVer=am.OVer
    LEFT OUTER JOIN FHCPath bc ON bc.OID=bb.osrelNuPathId
    LEFT OUTER JOIN OIDOVers n ON n.OID=m.adTarget AND  n.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass q ON q.OID=m.adTarget AND q.OVer=m.OVer
    LEFT OUTER JOIN OIDOVers v ON v.OID=u.adSource AND  v.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass y ON y.OID=u.adSource AND y.OVer=u.OVer
    LEFT OUTER JOIN TCSourceObject ar ON ar.OID=aq.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject r ON r.OID=q.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject z ON z.OID=y.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath at ON at.OID=ar.osrelNuPathId
    LEFT OUTER JOIN FHCPath s ON s.OID=r.osrelNuPathId
    LEFT OUTER JOIN FHCPath aa ON aa.OID=z.osrelNuPathId;

CREATE VIEW DAQDATAELEMENT AS 
  SELECT
    a.*,
    f.name as dataElement,
    o.name as elementAlias,
    s.asBitData,
    s.genericPicture,
    s.isComplex,
    s.isSigned,
    s.isLOB,
    s.precision as numericPrecision,
    s.scale,
    s.strLength as stringLength,
    s.strVaryingFlag as stringVaryingCode,
    s.typeCode,
    s.vgSignFormat as vagSignFormat,
    y.contents as elementDescription,
    y.label as elementDescType
  FROM
    OIDOVers a
    INNER JOIN DSDataElement_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target g ON g.classAttr='DSDataElement_version.aliases' AND
      g.targetOID=b.OID AND g.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='DSLinkDEAlias2DataElmn' 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 adobjectFind p ON p.OID=b.pSimpleTypeDef AND
       p.className='DSLinkDataElmn2SmplType' AND
       p.contextRelease=a.contextRelease AND p.contextName=a.contextName
    LEFT OUTER JOIN ADLink q ON q.OID=p.OID AND q.OVer=p.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers j ON j.OID=i.adSource AND  j.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass m ON m.OID=i.adSource AND m.OVer=i.OVer
    LEFT OUTER JOIN adobjectFind r ON r.OID=q.adTarget AND
       r.className='DSSimpleTypeDef' AND
       r.contextRelease=a.contextRelease AND r.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject n ON n.OID=m.osrelTCSourceObjct
    LEFT OUTER JOIN DSSimpleTypeDef s ON s.OID=r.OID AND s.OVer=r.OVer
    INNER JOIN ADObject t ON t.OID=b.OID AND t.OVer=b.OVer AND
     t.className='DSDataElement_version'
    LEFT OUTER JOIN FHCPath o ON o.OID=n.osrelNuPathId
    LEFT OUTER JOIN ADLink_source u ON u.classAttr='ADAnnotatedObject.pAnnotationText' AND
      u.sourceOID=t.OID AND u.sourceOVer=t.OVer
    LEFT OUTER JOIN adobjectFind v ON v.OID=u.relOID AND v.OVer=u.relOVer AND
       v.className='ADLinkADAnnotObj2AnnotTxt' AND
       v.contextRelease=a.contextRelease AND v.contextName=a.contextName
    LEFT OUTER JOIN ADLink w ON w.OID=v.OID AND w.OVer=v.OVer
    LEFT OUTER JOIN adobjectFind x ON x.OID=w.adTarget AND
       x.className='ADAnnotationText' AND
       x.contextRelease=a.contextRelease AND x.contextName=a.contextName
    LEFT OUTER JOIN ADAnnotationText y ON y.OID=x.OID AND y.OVer=x.OVer;

CREATE VIEW DAQDEALIASBase AS 
  SELECT
    a.*,
    f.name as elementAlias
  FROM
    OIDOVers a
    INNER JOIN DSDatElmntAls_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId;

CREATE VIEW DAQDEUSAGE AS 
  SELECT
    a.*,
    f.name as dataElement,
    y.name as imsField,
    ak.name as imsSegment,
    at.name as rootDBDName,
    bg.name as imsFieldS,
    bs.name as imsSegmentS,
    ca.name as rootDBDNameS,
    cj.name as vagDataItem,
    cs.name as dataStructure,
    db.name as includedSourcDfntn
  FROM
    OIDOVers a
    INNER JOIN DSDataElement_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    INNER JOIN FHCVersion c ON c.OID=b.OID AND c.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target cb ON cb.classAttr='FHCVersion.referencedBy' AND
      cb.targetOID=c.OID AND cb.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind cc ON cc.OID=cb.relOID AND cc.OVer=cb.relOVer AND
       cc.className='ADLinkTCPartDependsOnTCPart' AND
       cc.contextRelease=a.contextRelease AND cc.contextName=a.contextName
    LEFT OUTER JOIN ADLink cd ON cd.OID=cc.OID AND cd.OVer=cc.OVer
    LEFT OUTER JOIN ADLink_target ck ON ck.classAttr='FHCVersion.referencedBy' AND
      ck.targetOID=c.OID AND ck.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind cl ON cl.OID=ck.relOID AND cl.OVer=ck.relOVer AND
       cl.className='ADLinkTCPartDependsOnTCPart' AND
       cl.contextRelease=a.contextRelease AND cl.contextName=a.contextName
    LEFT OUTER JOIN ADLink cm ON cm.OID=cl.OID AND cm.OVer=cl.OVer
    LEFT OUTER JOIN ADLink_target ct ON ct.classAttr='FHCVersion.referencedBy' AND
      ct.targetOID=c.OID AND ct.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind cu ON cu.OID=ct.relOID AND cu.OVer=ct.relOVer AND
       cu.className='ADLinkTCPartDependsOnTCPart' AND
       cu.contextRelease=a.contextRelease AND cu.contextName=a.contextName
    LEFT OUTER JOIN ADLink cv ON cv.OID=cu.OID AND cv.OVer=cu.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    INNER JOIN ADObject g ON g.OID=b.OID AND g.OVer=b.OVer AND
     g.className='DSDataElement_version'
    LEFT OUTER JOIN OIDOVers ce ON ce.OID=cd.adSource AND  ce.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ch ON ch.OID=cd.adSource AND ch.OVer=cd.OVer
    LEFT OUTER JOIN OIDOVers cn ON cn.OID=cm.adSource AND  cn.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass cq ON cq.OID=cm.adSource AND cq.OVer=cm.OVer
    LEFT OUTER JOIN OIDOVers cw ON cw.OID=cv.adSource AND  cw.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass cz ON cz.OID=cv.adSource AND cz.OVer=cv.OVer
    LEFT OUTER JOIN ADLink_target h ON h.classAttr='DSSharedDataDefinition_version.dataItems' AND
      h.targetOID=g.OID AND h.targetOVer=g.OVer
    LEFT OUTER JOIN adobjectFind i ON i.OID=h.relOID AND i.OVer=h.relOVer 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 TCSourceObject ci ON ci.OID=ch.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject cr ON cr.OID=cq.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject da ON da.OID=cz.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind k ON k.OID=j.adSource AND
       k.className='DSDataItem' AND
       k.contextRelease=a.contextRelease AND k.contextName=a.contextName
    LEFT OUTER JOIN FHCPath cj ON cj.OID=ci.osrelNuPathId
    LEFT OUTER JOIN FHCPath cs ON cs.OID=cr.osrelNuPathId
    LEFT OUTER JOIN FHCPath db ON db.OID=da.osrelNuPathId
    LEFT OUTER JOIN DSDataItem l ON l.OID=k.OID AND l.OVer=k.OVer
    LEFT OUTER JOIN ADLink_target m ON m.classAttr='DSDataItem.fieldsForIMS' AND
      m.targetOID=l.OID AND m.targetOVer=l.OVer
    LEFT OUTER JOIN adobjectFind n ON n.OID=m.relOID AND n.OVer=m.relOVer AND
       n.className='DSMakesUseOf' AND
       n.contextRelease=a.contextRelease AND n.contextName=a.contextName
    LEFT OUTER JOIN ADLink o ON o.OID=n.OID AND o.OVer=n.OVer
    LEFT OUTER JOIN ADLink_target au ON au.classAttr='DSDataItem.fieldsSharedByIMS' AND
      au.targetOID=l.OID AND au.targetOVer=l.OVer
    LEFT OUTER JOIN adobjectFind av ON av.OID=au.relOID AND av.OVer=au.relOVer AND
       av.className='DSSharesUseOf' AND
       av.contextRelease=a.contextRelease AND av.contextName=a.contextName
    LEFT OUTER JOIN ADLink aw ON aw.OID=av.OID AND aw.OVer=av.OVer
    LEFT OUTER JOIN adobjectFind p ON p.OID=o.adSource AND
       p.className='DSField' AND
       p.contextRelease=a.contextRelease AND p.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind ax ON ax.OID=aw.adSource AND
       ax.className='DSField' AND
       ax.contextRelease=a.contextRelease AND ax.contextName=a.contextName
    LEFT OUTER JOIN DSField q ON q.OID=p.OID AND q.OVer=p.OVer
    LEFT OUTER JOIN DSField ay ON ay.OID=ax.OID AND ay.OVer=ax.OVer
    LEFT OUTER JOIN adobjectFind r ON r.OID=q.fldName AND
       r.className='DSHasIMSfldName' 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 adobjectFind z ON z.OID=q.sourceSegment AND
       z.className='DSHasField' AND
       z.contextRelease=a.contextRelease AND z.contextName=a.contextName
    LEFT OUTER JOIN ADLink aa ON aa.OID=z.OID AND aa.OVer=z.OVer
    LEFT OUTER JOIN adobjectFind az ON az.OID=ay.fldName AND
       az.className='DSHasIMSfldName' 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 adobjectFind bh ON bh.OID=ay.sourceSegment AND
       bh.className='DSHasField' AND
       bh.contextRelease=a.contextRelease AND bh.contextName=a.contextName
    LEFT OUTER JOIN ADLink bi ON bi.OID=bh.OID AND bi.OVer=bh.OVer
    LEFT OUTER JOIN OIDOVers t ON t.OID=s.adTarget AND  t.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass w ON w.OID=s.adTarget AND w.OVer=s.OVer
    LEFT OUTER JOIN adobjectFind ab ON ab.OID=aa.adSource AND
       ab.className='DSSegment' AND
       ab.contextRelease=a.contextRelease AND ab.contextName=a.contextName
    LEFT OUTER JOIN OIDOVers bb ON bb.OID=ba.adTarget AND  bb.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass be ON be.OID=ba.adTarget AND be.OVer=ba.OVer
    LEFT OUTER JOIN adobjectFind bj ON bj.OID=bi.adSource AND
       bj.className='DSSegment' AND
       bj.contextRelease=a.contextRelease AND bj.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject x ON x.OID=w.osrelTCSourceObjct
    LEFT OUTER JOIN DSSegment ac ON ac.OID=ab.OID AND ac.OVer=ab.OVer
    LEFT OUTER JOIN TCSourceObject bf ON bf.OID=be.osrelTCSourceObjct
    LEFT OUTER JOIN DSSegment bk ON bk.OID=bj.OID AND bk.OVer=bj.OVer
    LEFT OUTER JOIN FHCPath y ON y.OID=x.osrelNuPathId
    LEFT OUTER JOIN adobjectFind ad ON ad.OID=ac.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 adobjectFind al ON al.OID=ac.containingDBD AND
       al.className='DSContainsSegment' AND
       al.contextRelease=a.contextRelease AND al.contextName=a.contextName
    LEFT OUTER JOIN ADLink am ON am.OID=al.OID AND am.OVer=al.OVer
    LEFT OUTER JOIN FHCPath bg ON bg.OID=bf.osrelNuPathId
    LEFT OUTER JOIN adobjectFind bl ON bl.OID=bk.segmName AND
       bl.className='DSHasIMSsegmName' AND
       bl.contextRelease=a.contextRelease AND bl.contextName=a.contextName
    LEFT OUTER JOIN ADLink bm ON bm.OID=bl.OID AND bm.OVer=bl.OVer
    LEFT OUTER JOIN adobjectFind bt ON bt.OID=bk.containingDBD AND
       bt.className='DSContainsSegment' AND
       bt.contextRelease=a.contextRelease AND bt.contextName=a.contextName
    LEFT OUTER JOIN ADLink bu ON bu.OID=bt.OID AND bu.OVer=bt.OVer
    LEFT OUTER JOIN OIDOVers af ON af.OID=ae.adTarget AND  af.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ai ON ai.OID=ae.adTarget AND ai.OVer=ae.OVer
    LEFT OUTER JOIN OIDOVers an ON an.OID=am.adSource AND  an.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass aq ON aq.OID=am.adSource AND aq.OVer=am.OVer
    LEFT OUTER JOIN OIDOVers bn ON bn.OID=bm.adTarget AND  bn.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass bq ON bq.OID=bm.adTarget AND bq.OVer=bm.OVer
    LEFT OUTER JOIN OIDOVers bv ON bv.OID=bu.adSource AND  bv.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass by ON by.OID=bu.adSource AND by.OVer=bu.OVer
    LEFT OUTER JOIN TCSourceObject aj ON aj.OID=ai.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject ar ON ar.OID=aq.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject br ON br.OID=bq.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject bz ON bz.OID=by.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath ak ON ak.OID=aj.osrelNuPathId
    LEFT OUTER JOIN FHCPath at ON at.OID=ar.osrelNuPathId
    LEFT OUTER JOIN FHCPath bs ON bs.OID=br.osrelNuPathId
    LEFT OUTER JOIN FHCPath ca ON ca.OID=bz.osrelNuPathId;

CREATE VIEW DAQBUILDIMPACT AS 
  SELECT
    a.*,
    e.name as adName,
    d.changeDate as lastUpdateTimeStmp,
    b.buildStatus,
    f.typeName as partType,
    d.type,
    j.PartTimeStamp,
    i.includeFlag,
    p.name as adName1,
    l.beTS,
    l.builderRC,
    l.outputFileParms,
    l.buildParms,
    t.PartTimeStamp as PartTimeStamp1
  FROM
    OIDOVers a
    INNER JOIN FHCVersion b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass c ON c.OID=b.OID AND c.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject d ON d.OID=c.osrelTCSourceObjct
    LEFT OUTER JOIN ManyPtrTable g ON g.classAttrib='FHCVersion.transformedBy' AND
      g.SourceOID=b.OID AND g.SourceOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.targetOID AND h.OVer=g.sourceOVer AND
       h.contextRelease=a.contextRelease AND h.contextName=a.contextName
    LEFT OUTER JOIN FHCPath e ON e.OID=d.osrelNuPathId
    INNER JOIN TCCollectorClass f ON f.OID=b.OID AND f.OVer=b.OVer
    LEFT OUTER JOIN FHBTransformdByInf i ON i.OID=h.OID AND i.OVer=h.OVer
    LEFT OUTER JOIN FHBuildInfo j ON j.OID=i.OID AND j.OVer=i.OVer
    LEFT OUTER JOIN OIDOVers k ON k.OID=i.pBE AND  k.contextOID=a.contextOID
    LEFT OUTER JOIN FHBuildEvent_versn l ON l.OID=i.pBE AND l.OVer=k.OVer
    LEFT OUTER JOIN TCVersionClass n ON n.OID=l.OID AND n.OVer=l.OVer
    LEFT OUTER JOIN TCSourceObject o ON o.OID=n.osrelTCSourceObjct
    LEFT OUTER JOIN ManyPtrTable q ON q.classAttrib='FHBuildEvent_version.generates' AND
      q.SourceOID=l.OID AND q.SourceOVer=l.OVer
    LEFT OUTER JOIN adobjectFind r ON r.OID=q.targetOID AND r.OVer=q.sourceOVer AND
       r.contextRelease=a.contextRelease AND r.contextName=a.contextName
    LEFT OUTER JOIN FHCPath p ON p.OID=o.osrelNuPathId
    LEFT OUTER JOIN FHBuildInfo t ON t.OID=r.OID AND t.OVer=r.OVer;

CREATE VIEW DAQDEAliasImpact AS 
  SELECT
    a.*,
    f.name as elementAlias,
    n.name as dataElement,
    ag.name as cobolDataStructure,
    az.name as nestedCoblDtStrctr,
    br.name as dataStructure,
    cj.name as nestedDataStructur,
    cw.name as mappedIMSField,
    di.name as mappedIMSSegment,
    dq.name as mappedDBD,
    dz.name as VGDataItem,
    eq.name as IMSSegment,
    ey.name as DBD
  FROM
    OIDOVers a
    INNER JOIN DSDatElmntAls_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    INNER JOIN FHCVersion c ON c.OID=b.OID AND c.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind g ON g.OID=b.pDataElement AND
       g.className='DSLinkDEAlias2DataElmn' AND
       g.contextRelease=a.contextRelease AND g.contextName=a.contextName
    LEFT OUTER JOIN ADLink h ON h.OID=g.OID AND h.OVer=g.OVer
    LEFT OUTER JOIN ADLink_target ba ON ba.classAttr='DSSDDAlias_version.DILocalNames' AND
      ba.targetOID=b.OID AND ba.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind bb ON bb.OID=ba.relOID AND bb.OVer=ba.relOVer AND
       bb.className='DSLinkDataItm2SDDAlias' AND
       bb.contextRelease=a.contextRelease AND bb.contextName=a.contextName
    LEFT OUTER JOIN ADLink bc ON bc.OID=bb.OID AND bc.OVer=bb.OVer
    LEFT OUTER JOIN ADLink_target dr ON dr.classAttr='FHCVersion.referencedBy' AND
      dr.targetOID=c.OID AND dr.targetOVer=c.OVer
    LEFT OUTER JOIN adobjectFind ds ON ds.OID=dr.relOID AND ds.OVer=dr.relOVer AND
       ds.className='ADLinkTCPartDependsOnTCPart' AND
       ds.contextRelease=a.contextRelease AND ds.contextName=a.contextName
    LEFT OUTER JOIN ADLink dt ON dt.OID=ds.OID AND dt.OVer=ds.OVer
    LEFT OUTER JOIN ADLink_target ea ON ea.classAttr='DSSDDAlias_version.fieldNames' AND
      ea.targetOID=b.OID AND ea.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind eb ON eb.OID=ea.relOID AND eb.OVer=ea.relOVer AND
       eb.className='DSHasIMSfldName' AND
       eb.contextRelease=a.contextRelease AND eb.contextName=a.contextName
    LEFT OUTER JOIN ADLink ec ON ec.OID=eb.OID AND ec.OVer=eb.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers i ON i.OID=h.adTarget AND  i.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass l ON l.OID=h.adTarget AND l.OVer=h.OVer
    LEFT OUTER JOIN adobjectFind bd ON bd.OID=bc.adSource AND
       bd.className='DSDataItem' AND
       bd.contextRelease=a.contextRelease AND bd.contextName=a.contextName
    LEFT OUTER JOIN OIDOVers du ON du.OID=dt.adSource AND  du.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass dx ON dx.OID=dt.adSource AND dx.OVer=dt.OVer
    LEFT OUTER JOIN adobjectFind ed ON ed.OID=ec.adSource AND
       ed.className='DSField' AND
       ed.contextRelease=a.contextRelease AND ed.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject m ON m.OID=l.osrelTCSourceObjct
    LEFT OUTER JOIN DSDataItem be ON be.OID=bd.OID AND be.OVer=bd.OVer
    LEFT OUTER JOIN DSDataComponent bf ON bf.OID=be.OID AND bf.OVer=be.OVer
    LEFT OUTER JOIN TCSourceObject dy ON dy.OID=dx.osrelTCSourceObjct
    LEFT OUTER JOIN DSField ee ON ee.OID=ed.OID AND ee.OVer=ed.OVer
    LEFT OUTER JOIN FHCPath n ON n.OID=m.osrelNuPathId
    INNER JOIN ADObject o ON o.OID=b.OID AND o.OVer=b.OVer AND
     o.className='DSDataElementAlias_version'
    LEFT OUTER JOIN adobjectFind bg ON bg.OID=bf.pStructureDef AND
       bg.className='DSLinkStrctDefComponent' AND
       bg.contextRelease=a.contextRelease AND bg.contextName=a.contextName
    LEFT OUTER JOIN ADLink bh ON bh.OID=bg.OID AND bh.OVer=bg.OVer
    LEFT OUTER JOIN ADLink_target ck ON ck.classAttr='DSDataItem.fieldsForIMS' AND
      ck.targetOID=be.OID AND ck.targetOVer=be.OVer
    LEFT OUTER JOIN adobjectFind cl ON cl.OID=ck.relOID AND cl.OVer=ck.relOVer AND
       cl.className='DSMakesUseOf' AND
       cl.contextRelease=a.contextRelease AND cl.contextName=a.contextName
    LEFT OUTER JOIN ADLink cm ON cm.OID=cl.OID AND cm.OVer=cl.OVer
    LEFT OUTER JOIN FHCPath dz ON dz.OID=dy.osrelNuPathId
    LEFT OUTER JOIN adobjectFind ef ON ef.OID=ee.sourceSegment AND
       ef.className='DSHasField' AND
       ef.contextRelease=a.contextRelease AND ef.contextName=a.contextName
    LEFT OUTER JOIN ADLink eg ON eg.OID=ef.OID AND eg.OVer=ef.OVer
    LEFT OUTER JOIN ADLink_target p ON p.classAttr='DSSDDAlias_version.DICobolNames' AND
      p.targetOID=o.OID AND p.targetOVer=o.OVer
    LEFT OUTER JOIN adobjectFind q ON q.OID=p.relOID AND q.OVer=p.relOVer AND
       q.className='DSLinkDataItm2SDDAlias1' AND
       q.contextRelease=a.contextRelease AND q.contextName=a.contextName
    LEFT OUTER JOIN ADLink r ON r.OID=q.OID AND r.OVer=q.OVer
    LEFT OUTER JOIN adobjectFind bi ON bi.OID=bh.adSource AND
       bi.className='DSStructureDef' AND
       bi.contextRelease=a.contextRelease AND bi.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind cn ON cn.OID=cm.adSource AND
       cn.className='DSField' AND
       cn.contextRelease=a.contextRelease AND cn.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind eh ON eh.OID=eg.adSource AND
       eh.className='DSSegment' AND
       eh.contextRelease=a.contextRelease AND eh.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind s ON s.OID=r.adSource AND
       s.className='DSDataItem' AND
       s.contextRelease=a.contextRelease AND s.contextName=a.contextName
    LEFT OUTER JOIN DSStructureDef bj ON bj.OID=bi.OID AND bj.OVer=bi.OVer
    LEFT OUTER JOIN DSField co ON co.OID=cn.OID AND co.OVer=cn.OVer
    LEFT OUTER JOIN DSSegment ei ON ei.OID=eh.OID AND ei.OVer=eh.OVer
    LEFT OUTER JOIN DSDataComponent u ON u.OID=s.OID AND u.OVer=s.OVer
    LEFT OUTER JOIN adobjectFind bk ON bk.OID=bj.pSharedStructure AND
       bk.className='DSLinkDataStrc2StrctDef' AND
       bk.contextRelease=a.contextRelease AND bk.contextName=a.contextName
    LEFT OUTER JOIN ADLink bl ON bl.OID=bk.OID AND bl.OVer=bk.OVer
    LEFT OUTER JOIN adobjectFind cp ON cp.OID=co.fldName AND
       cp.className='DSHasIMSfldName' AND
       cp.contextRelease=a.contextRelease AND cp.contextName=a.contextName
    LEFT OUTER JOIN ADLink cq ON cq.OID=cp.OID AND cq.OVer=cp.OVer
    LEFT OUTER JOIN adobjectFind cx ON cx.OID=co.sourceSegment AND
       cx.className='DSHasField' AND
       cx.contextRelease=a.contextRelease AND cx.contextName=a.contextName
    LEFT OUTER JOIN ADLink cy ON cy.OID=cx.OID AND cy.OVer=cx.OVer
    LEFT OUTER JOIN adobjectFind ej ON ej.OID=ei.segmName AND
       ej.className='DSHasIMSsegmName' AND
       ej.contextRelease=a.contextRelease AND ej.contextName=a.contextName
    LEFT OUTER JOIN ADLink ek ON ek.OID=ej.OID AND ek.OVer=ej.OVer
    LEFT OUTER JOIN adobjectFind er ON er.OID=ei.containingDBD AND
       er.className='DSContainsSegment' AND
       er.contextRelease=a.contextRelease AND er.contextName=a.contextName
    LEFT OUTER JOIN ADLink es ON es.OID=er.OID AND es.OVer=er.OVer
    LEFT OUTER JOIN adobjectFind v ON v.OID=u.pStructureDef AND
       v.className='DSLinkStrctDefComponent' AND
       v.contextRelease=a.contextRelease AND v.contextName=a.contextName
    LEFT OUTER JOIN ADLink w ON w.OID=v.OID AND w.OVer=v.OVer
    LEFT OUTER JOIN OIDOVers bm ON bm.OID=bl.adSource AND  bm.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass bp ON bp.OID=bl.adSource AND bp.OVer=bl.OVer
    LEFT OUTER JOIN OIDOVers cr ON cr.OID=cq.adTarget AND  cr.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass cu ON cu.OID=cq.adTarget AND cu.OVer=cq.OVer
    LEFT OUTER JOIN adobjectFind cz ON cz.OID=cy.adSource AND
       cz.className='DSSegment' AND
       cz.contextRelease=a.contextRelease AND cz.contextName=a.contextName
    LEFT OUTER JOIN OIDOVers el ON el.OID=ek.adTarget AND  el.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass eo ON eo.OID=ek.adTarget AND eo.OVer=ek.OVer
    LEFT OUTER JOIN OIDOVers et ON et.OID=es.adSource AND  et.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ew ON ew.OID=es.adSource AND ew.OVer=es.OVer
    LEFT OUTER JOIN adobjectFind x ON x.OID=w.adSource AND
       x.className='DSStructureDef' AND
       x.contextRelease=a.contextRelease AND x.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject bq ON bq.OID=bp.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject cv ON cv.OID=cu.osrelTCSourceObjct
    LEFT OUTER JOIN DSSegment da ON da.OID=cz.OID AND da.OVer=cz.OVer
    LEFT OUTER JOIN TCSourceObject ep ON ep.OID=eo.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject ex ON ex.OID=ew.osrelTCSourceObjct
    LEFT OUTER JOIN DSStructureDef y ON y.OID=x.OID AND y.OVer=x.OVer
    LEFT OUTER JOIN FHCPath br ON br.OID=bq.osrelNuPathId
    LEFT OUTER JOIN DSDataDefinition bs ON bs.OID=bj.OID AND bs.OVer=bj.OVer
    LEFT OUTER JOIN FHCPath cw ON cw.OID=cv.osrelNuPathId
    LEFT OUTER JOIN adobjectFind db ON db.OID=da.segmName AND
       db.className='DSHasIMSsegmName' AND
       db.contextRelease=a.contextRelease AND db.contextName=a.contextName
    LEFT OUTER JOIN ADLink dc ON dc.OID=db.OID AND dc.OVer=db.OVer
    LEFT OUTER JOIN adobjectFind dj ON dj.OID=da.containingDBD AND
       dj.className='DSContainsSegment' AND
       dj.contextRelease=a.contextRelease AND dj.contextName=a.contextName
    LEFT OUTER JOIN ADLink dk ON dk.OID=dj.OID AND dk.OVer=dj.OVer
    LEFT OUTER JOIN FHCPath eq ON eq.OID=ep.osrelNuPathId
    LEFT OUTER JOIN FHCPath ey ON ey.OID=ex.osrelNuPathId
    LEFT OUTER JOIN adobjectFind z ON z.OID=y.pSharedStructure AND
       z.className='DSLinkDataStrc2StrctDef' AND
       z.contextRelease=a.contextRelease AND z.contextName=a.contextName
    LEFT OUTER JOIN ADLink aa ON aa.OID=z.OID AND aa.OVer=z.OVer
    LEFT OUTER JOIN adobjectFind bt ON bt.OID=bs.dataItems AND
       bt.className='DSLinkDataItm2DataDef' AND
       bt.contextRelease=a.contextRelease AND bt.contextName=a.contextName
    LEFT OUTER JOIN ADLink bu ON bu.OID=bt.OID AND bu.OVer=bt.OVer
    LEFT OUTER JOIN OIDOVers dd ON dd.OID=dc.adTarget AND  dd.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass dg ON dg.OID=dc.adTarget AND dg.OVer=dc.OVer
    LEFT OUTER JOIN OIDOVers dl ON dl.OID=dk.adSource AND  dl.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass do ON do.OID=dk.adSource AND do.OVer=dk.OVer
    LEFT OUTER JOIN OIDOVers ab ON ab.OID=aa.adSource AND  ab.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ae ON ae.OID=aa.adSource AND ae.OVer=aa.OVer
    LEFT OUTER JOIN adobjectFind bv ON bv.OID=bu.adSource AND
       bv.className='DSDataItem' AND
       bv.contextRelease=a.contextRelease AND bv.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject dh ON dh.OID=dg.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject dp ON dp.OID=do.osrelTCSourceObjct
    LEFT OUTER JOIN TCSourceObject af ON af.OID=ae.osrelTCSourceObjct
    LEFT OUTER JOIN DSDataComponent bx ON bx.OID=bv.OID AND bx.OVer=bv.OVer
    LEFT OUTER JOIN FHCPath di ON di.OID=dh.osrelNuPathId
    LEFT OUTER JOIN FHCPath dq ON dq.OID=dp.osrelNuPathId
    LEFT OUTER JOIN FHCPath ag ON ag.OID=af.osrelNuPathId
    LEFT OUTER JOIN DSDataDefinition ah ON ah.OID=y.OID AND ah.OVer=y.OVer
    LEFT OUTER JOIN adobjectFind by ON by.OID=bx.pStructureDef AND
       by.className='DSLinkStrctDefComponent' AND
       by.contextRelease=a.contextRelease AND by.contextName=a.contextName
    LEFT OUTER JOIN ADLink bz ON bz.OID=by.OID AND bz.OVer=by.OVer
    LEFT OUTER JOIN adobjectFind ai ON ai.OID=ah.dataItems AND
       ai.className='DSLinkDataItm2DataDef' AND
       ai.contextRelease=a.contextRelease AND ai.contextName=a.contextName
    LEFT OUTER JOIN ADLink aj ON aj.OID=ai.OID AND aj.OVer=ai.OVer
    LEFT OUTER JOIN adobjectFind ca ON ca.OID=bz.adSource AND
       ca.className='DSStructureDef' AND
       ca.contextRelease=a.contextRelease AND ca.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind ak ON ak.OID=aj.adSource AND
       ak.className='DSDataItem' AND
       ak.contextRelease=a.contextRelease AND ak.contextName=a.contextName
    LEFT OUTER JOIN DSStructureDef cb ON cb.OID=ca.OID AND cb.OVer=ca.OVer
    LEFT OUTER JOIN DSDataComponent am ON am.OID=ak.OID AND am.OVer=ak.OVer
    LEFT OUTER JOIN adobjectFind cc ON cc.OID=cb.pSharedStructure AND
       cc.className='DSLinkDataStrc2StrctDef' AND
       cc.contextRelease=a.contextRelease AND cc.contextName=a.contextName
    LEFT OUTER JOIN ADLink cd ON cd.OID=cc.OID AND cd.OVer=cc.OVer
    LEFT OUTER JOIN adobjectFind an ON an.OID=am.pStructureDef AND
       an.className='DSLinkStrctDefComponent' AND
       an.contextRelease=a.contextRelease AND an.contextName=a.contextName
    LEFT OUTER JOIN ADLink ao ON ao.OID=an.OID AND ao.OVer=an.OVer
    LEFT OUTER JOIN OIDOVers ce ON ce.OID=cd.adSource AND  ce.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ch ON ch.OID=cd.adSource AND ch.OVer=cd.OVer
    LEFT OUTER JOIN adobjectFind ap ON ap.OID=ao.adSource AND
       ap.className='DSStructureDef' AND
       ap.contextRelease=a.contextRelease AND ap.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject ci ON ci.OID=ch.osrelTCSourceObjct
    LEFT OUTER JOIN DSStructureDef aq ON aq.OID=ap.OID AND aq.OVer=ap.OVer
    LEFT OUTER JOIN FHCPath cj ON cj.OID=ci.osrelNuPathId
    LEFT OUTER JOIN adobjectFind ar ON ar.OID=aq.pSharedStructure AND
       ar.className='DSLinkDataStrc2StrctDef' AND
       ar.contextRelease=a.contextRelease AND ar.contextName=a.contextName
    LEFT OUTER JOIN ADLink at ON at.OID=ar.OID AND at.OVer=ar.OVer
    LEFT OUTER JOIN OIDOVers au ON au.OID=at.adSource AND  au.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass ax ON ax.OID=at.adSource AND ax.OVer=at.OVer
    LEFT OUTER JOIN TCSourceObject ay ON ay.OID=ax.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath az ON az.OID=ay.osrelNuPathId;

CREATE VIEW DAQDSALIAS AS 
  SELECT
    a.*,
    f.name as structureAlias,
    n.name as structureName
  FROM
    OIDOVers a
    INNER JOIN DSDtStrctrAls_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind g ON g.OID=b.pDataStructure AND
       g.className='DSLinkDSAlias2DataStrc' AND
       g.contextRelease=a.contextRelease AND g.contextName=a.contextName
    LEFT OUTER JOIN ADLink h ON h.OID=g.OID AND h.OVer=g.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers i ON i.OID=h.adTarget AND  i.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass l ON l.OID=h.adTarget AND l.OVer=h.OVer
    LEFT OUTER JOIN TCSourceObject m ON m.OID=l.osrelTCSourceObjct
    LEFT OUTER JOIN FHCPath n ON n.OID=m.osrelNuPathId;

CREATE VIEW DAQDATAELEMENTHIER AS 
  SELECT
    a.*,
    f.name as dataElement,
    n.name as parentDataElement,
    r.asBitData,
    r.genericPicture,
    r.isComplex,
    r.isSigned,
    r.isLOB,
    r.precision as numericPrecision,
    r.scale,
    r.strLength as stringLength,
    r.strVaryingFlag as stringVaryingCode,
    r.typeCode,
    r.vgSignFormat as vagSignFormat
  FROM
    OIDOVers a
    INNER JOIN DSDataElement_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind g ON g.OID=b.pParent AND
       g.className='DSLinkDataElmnHasChild' AND
       g.contextRelease=a.contextRelease AND g.contextName=a.contextName
    LEFT OUTER JOIN ADLink h ON h.OID=g.OID AND h.OVer=g.OVer
    LEFT OUTER JOIN FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN OIDOVers i ON i.OID=h.adSource AND  i.contextOID=a.contextOID
    LEFT OUTER JOIN DSDataElement_vrsn j ON j.OID=h.adSource AND j.OVer=i.OVer
    LEFT OUTER JOIN TCVersionClass l ON l.OID=j.OID AND l.OVer=j.OVer
    LEFT OUTER JOIN TCSourceObject m ON m.OID=l.osrelTCSourceObjct
    LEFT OUTER JOIN adobjectFind o ON o.OID=j.pSimpleTypeDef AND
       o.className='DSLinkDataElmn2SmplType' 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 FHCPath n ON n.OID=m.osrelNuPathId
    LEFT OUTER JOIN adobjectFind q ON q.OID=p.adTarget AND
       q.className='DSSimpleTypeDef' AND
       q.contextRelease=a.contextRelease AND q.contextName=a.contextName
    LEFT OUTER JOIN DSSimpleTypeDef r ON r.OID=q.OID AND r.OVer=q.OVer;

CREATE VIEW DAQSDEERWINUSAGE AS 
  SELECT
    a.*,
    f.name as dataElement,
    l.objectName as columnName,
    k.nullsAllowed,
    t.name as tableName,
    x.asBitData,
    x.genericPicture,
    x.isComplex,
    x.isSigned,
    x.isLOB,
    x.precision as numericPrecision,
    x.scale,
    x.strLength as stringLength,
    x.strVaryingFlag as stringVaryingCode,
    x.typeCode,
    x.vgSignFormat as vagSignFormat,
    ad.contents as elementDescription,
    ad.label as elementDescType
  FROM
    OIDOVers a
    INNER JOIN DSDataElement_vrsn b ON a.OID=b.OID AND a.OVer=b.OVer
    LEFT OUTER JOIN TCVersionClass d ON d.OID=b.OID AND d.OVer=b.OVer
    LEFT OUTER JOIN TCSourceObject e ON e.OID=d.osrelTCSourceObjct
    LEFT OUTER JOIN ADLink_target g ON g.classAttr='DSDataElement_version.usedByColumn' AND
      g.targetOID=b.OID AND g.targetOVer=b.OVer
    LEFT OUTER JOIN adobjectFind h ON h.OID=g.relOID AND h.OVer=g.relOVer AND
       h.className='ERWColumnUsesDomain' 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 adobjectFind u ON u.OID=b.pSimpleTypeDef AND
       u.className='DSLinkDataElmn2SmplType' 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 FHCPath f ON f.OID=e.osrelNuPathId
    LEFT OUTER JOIN adobjectFind j ON j.OID=i.adSource AND
       j.className='ERWColumn' AND
       j.contextRelease=a.contextRelease AND j.contextName=a.contextName
    LEFT OUTER JOIN adobjectFind w ON w.OID=v.adTarget AND
       w.className='DSSimpleTypeDef' AND
       w.contextRelease=a.contextRelease AND w.contextName=a.contextName
    LEFT OUTER JOIN ERWColumn k ON k.OID=j.OID AND k.OVer=j.OVer
    LEFT OUTER JOIN ERWModelObject l ON l.OID=k.OID AND l.OVer=k.OVer
    LEFT OUTER JOIN DSSimpleTypeDef x ON x.OID=w.OID AND x.OVer=w.OVer
    INNER JOIN ADObject y ON y.OID=b.OID AND y.OVer=b.OVer AND
     y.className='DSDataElement_version'
    LEFT OUTER JOIN adobjectFind m ON m.OID=k.forTable AND
       m.className='ERWTableHasColumn' AND
       m.contextRelease=a.contextRelease AND m.contextName=a.contextName
    LEFT OUTER JOIN ADLink n ON n.OID=m.OID AND n.OVer=m.OVer
    LEFT OUTER JOIN ADLink_source z ON z.classAttr='ADAnnotatedObject.pAnnotationText' AND
      z.sourceOID=y.OID AND z.sourceOVer=y.OVer
    LEFT OUTER JOIN adobjectFind aa ON aa.OID=z.relOID AND aa.OVer=z.relOVer AND
       aa.className='ADLinkADAnnotObj2AnnotTxt' 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 OIDOVers o ON o.OID=n.adSource AND  o.contextOID=a.contextOID
    LEFT OUTER JOIN TCVersionClass r ON r.OID=n.adSource AND r.OVer=n.OVer
    LEFT OUTER JOIN adobjectFind ac ON ac.OID=ab.adTarget AND
       ac.className='ADAnnotationText' AND
       ac.contextRelease=a.contextRelease AND ac.contextName=a.contextName
    LEFT OUTER JOIN TCSourceObject s ON s.OID=r.osrelTCSourceObjct
    LEFT OUTER JOIN ADAnnotationText ad ON ad.OID=ac.OID AND ad.OVer=ac.OVer
    LEFT OUTER JOIN FHCPath t ON t.OID=s.osrelNuPathId;

