1

SQL Server を使用して、次の XML サンプルをフラット テーブルとして変換するような方法で XML ファイルをクエリしたいと考えています。

<?xml version="1.0" ?> 
  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
  <ns1:getArtifactDetailListResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schema.open.collab.net/sfee50/soap60/service">
  <getArtifactDetailListReturn href="#id0" /> 
  </ns1:getArtifactDetailListResponse>
  <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ArtifactDetailSoapList" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://schema.open.collab.net/sfee50/soap60/type">
  <dataRows soapenc:arrayType="ns2:ArtifactDetailSoapRow[4]" xsi:type="soapenc:Array">
  <dataRows href="#id1" /> 
  <dataRows href="#id2" /> 
  <dataRows href="#id3" /> 
  <dataRows href="#id4" /> 
  </dataRows>
  <fullListSize xsi:type="xsd:int">4</fullListSize> 
  </multiRef>
  <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:ArtifactDetailSoapRow" xmlns:ns3="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <actualEffort xsi:type="xsd:int">0</actualEffort> 
  <artifactGroup xsi:type="xsd:string" /> 
  <assignedToFullname xsi:type="xsd:string">Anon User</assignedToFullname> 
  <assignedToUsername xsi:type="xsd:string">anon_user</assignedToUsername> 
  <autosumming xsi:type="xsd:boolean">false</autosumming> 
  <category xsi:type="xsd:string">Internal Improvement</category> 
  <closeDate xsi:type="xsd:dateTime" xsi:nil="true" /> 
  <customer xsi:type="xsd:string" /> 
  <description xsi:type="xsd:string">Description Here</description> 
  <estimatedEffort xsi:type="xsd:int">0</estimatedEffort> 
  <flexFields href="#id5" /> 
  <folderId xsi:type="xsd:string">tracker15657</folderId> 
  <folderPathString xsi:type="xsd:string">tracker.brd_new_request</folderPathString> 
  <folderTitle xsi:type="xsd:string">BRDs (New/Change Requests)</folderTitle> 
  <id xsi:type="xsd:string">artf705037</id> 
  <lastModifiedDate xsi:type="xsd:dateTime">2013-02-01T10:43:02.000Z</lastModifiedDate> 
  <planningFolderId xsi:type="xsd:string" xsi:nil="true" /> 
  <planningFolderTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <points xsi:type="xsd:int">0</points> 
  <priority xsi:type="xsd:int">4</priority> 
  <projectId xsi:type="xsd:string">proj7173</projectId> 
  <projectPathString xsi:type="xsd:string">projects.rapid_application_developmet</projectPathString> 
  <projectTitle xsi:type="xsd:string">Rapid Application Development</projectTitle> 
  <remainingEffort xsi:type="xsd:int">0</remainingEffort> 
  <reportedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <reportedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <status xsi:type="xsd:string">RAD Reviewing</status> 
  <statusClass xsi:type="xsd:string">Open</statusClass> 
  <submittedByFullname xsi:type="xsd:string">Anon User</submittedByFullname> 
  <submittedByUsername xsi:type="xsd:string">anon_user</submittedByUsername> 
  <submittedDate xsi:type="xsd:dateTime">2013-02-01T10:43:02.000Z</submittedDate> 
  <title xsi:type="xsd:string">SWAPS - Weekly Tracer Exception Report</title> 
  <trackerIcon xsi:type="xsd:string" xsi:nil="true" /> 
  <version xsi:type="xsd:int">100</version> 
  </multiRef>
  <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:ArtifactDetailSoapRow" xmlns:ns4="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <actualEffort xsi:type="xsd:int">0</actualEffort> 
  <artifactGroup xsi:type="xsd:string" /> 
  <assignedToFullname xsi:type="xsd:string">Anon User</assignedToFullname> 
  <assignedToUsername xsi:type="xsd:string">anon_user</assignedToUsername> 
  <autosumming xsi:type="xsd:boolean">false</autosumming> 
  <category xsi:type="xsd:string">Internal Improvement</category> 
  <closeDate xsi:type="xsd:dateTime" xsi:nil="true" /> 
  <customer xsi:type="xsd:string" /> 
  <description xsi:type="xsd:string">KOP embelished for internal improvement/automation.</description> 
  <estimatedEffort xsi:type="xsd:int">0</estimatedEffort> 
  <flexFields href="#id6" /> 
  <folderId xsi:type="xsd:string">tracker15657</folderId> 
  <folderPathString xsi:type="xsd:string">tracker.brd_new_request</folderPathString> 
  <folderTitle xsi:type="xsd:string">BRDs (New/Change Requests)</folderTitle> 
  <id xsi:type="xsd:string">artf705038</id> 
  <lastModifiedDate xsi:type="xsd:dateTime">2013-02-01T10:49:14.000Z</lastModifiedDate> 
  <planningFolderId xsi:type="xsd:string" xsi:nil="true" /> 
  <planningFolderTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <points xsi:type="xsd:int">0</points> 
  <priority xsi:type="xsd:int">4</priority> 
  <projectId xsi:type="xsd:string">proj7173</projectId> 
  <projectPathString xsi:type="xsd:string">projects.rapid_application_developmet</projectPathString> 
  <projectTitle xsi:type="xsd:string">Rapid Application Development</projectTitle> 
  <remainingEffort xsi:type="xsd:int">0</remainingEffort> 
  <reportedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <reportedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <status xsi:type="xsd:string">RAD Reviewing</status> 
  <statusClass xsi:type="xsd:string">Open</statusClass> 
  <submittedByFullname xsi:type="xsd:string">Anon User</submittedByFullname> 
  <submittedByUsername xsi:type="xsd:string">anon_user</submittedByUsername> 
  <submittedDate xsi:type="xsd:dateTime">2013-02-01T10:49:14.000Z</submittedDate> 
  <title xsi:type="xsd:string">SWAPS   Weekly Trade Support Report</title> 
  <trackerIcon xsi:type="xsd:string" xsi:nil="true" /> 
  <version xsi:type="xsd:int">100</version> 
  </multiRef>
  <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:ArtifactDetailSoapRow" xmlns:ns5="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <actualEffort xsi:type="xsd:int">0</actualEffort> 
  <artifactGroup xsi:type="xsd:string" /> 
  <assignedToFullname xsi:type="xsd:string">Anon User</assignedToFullname> 
  <assignedToUsername xsi:type="xsd:string">anon_user</assignedToUsername> 
  <autosumming xsi:type="xsd:boolean">false</autosumming> 
  <category xsi:type="xsd:string">Internal Improvement</category> 
  <closeDate xsi:type="xsd:dateTime" xsi:nil="true" /> 
  <customer xsi:type="xsd:string" /> 
  <description xsi:type="xsd:string">BRD submitted for internal automation of BAU.</description> 
  <estimatedEffort xsi:type="xsd:int">0</estimatedEffort> 
  <flexFields href="#id7" /> 
  <folderId xsi:type="xsd:string">tracker15657</folderId> 
  <folderPathString xsi:type="xsd:string">tracker.brd_new_request</folderPathString> 
  <folderTitle xsi:type="xsd:string">BRDs (New/Change Requests)</folderTitle> 
  <id xsi:type="xsd:string">artf704445</id> 
  <lastModifiedDate xsi:type="xsd:dateTime">2013-01-30T16:31:35.000Z</lastModifiedDate> 
  <planningFolderId xsi:type="xsd:string" xsi:nil="true" /> 
  <planningFolderTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <points xsi:type="xsd:int">0</points> 
  <priority xsi:type="xsd:int">4</priority> 
  <projectId xsi:type="xsd:string">proj7173</projectId> 
  <projectPathString xsi:type="xsd:string">projects.rapid_application_developmet</projectPathString> 
  <projectTitle xsi:type="xsd:string">Rapid Application Development</projectTitle> 
  <remainingEffort xsi:type="xsd:int">0</remainingEffort> 
  <reportedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <reportedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <status xsi:type="xsd:string">RAD Reviewing</status> 
  <statusClass xsi:type="xsd:string">Open</statusClass> 
  <submittedByFullname xsi:type="xsd:string">Anon User</submittedByFullname> 
  <submittedByUsername xsi:type="xsd:string">anon_user</submittedByUsername> 
  <submittedDate xsi:type="xsd:dateTime">2013-01-30T16:29:02.000Z</submittedDate> 
  <title xsi:type="xsd:string">SWAPS Daily MIS Overall Performance</title> 
  <trackerIcon xsi:type="xsd:string" xsi:nil="true" /> 
  <version xsi:type="xsd:int">101</version> 
  </multiRef>
  <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns6:ArtifactDetailSoapRow" xmlns:ns6="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <actualEffort xsi:type="xsd:int">0</actualEffort> 
  <artifactGroup xsi:type="xsd:string" /> 
  <assignedToFullname xsi:type="xsd:string">Anon User</assignedToFullname> 
  <assignedToUsername xsi:type="xsd:string">anon_user</assignedToUsername> 
  <autosumming xsi:type="xsd:boolean">false</autosumming> 
  <category xsi:type="xsd:string">Internal Improvement</category> 
  <closeDate xsi:type="xsd:dateTime" xsi:nil="true" /> 
  <customer xsi:type="xsd:string" /> 
  <description xsi:type="xsd:string">BRD submitted for internal automation of BAU.</description> 
  <estimatedEffort xsi:type="xsd:int">0</estimatedEffort> 
  <flexFields href="#id8" /> 
  <folderId xsi:type="xsd:string">tracker15657</folderId> 
  <folderPathString xsi:type="xsd:string">tracker.brd_new_request</folderPathString> 
  <folderTitle xsi:type="xsd:string">BRDs (New/Change Requests)</folderTitle> 
  <id xsi:type="xsd:string">artf704570</id> 
  <lastModifiedDate xsi:type="xsd:dateTime">2013-01-31T10:27:13.000Z</lastModifiedDate> 
  <planningFolderId xsi:type="xsd:string" xsi:nil="true" /> 
  <planningFolderTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <points xsi:type="xsd:int">0</points> 
  <priority xsi:type="xsd:int">4</priority> 
  <projectId xsi:type="xsd:string">proj7173</projectId> 
  <projectPathString xsi:type="xsd:string">projects.rapid_application_developmet</projectPathString> 
  <projectTitle xsi:type="xsd:string">Rapid Application Development</projectTitle> 
  <remainingEffort xsi:type="xsd:int">0</remainingEffort> 
  <reportedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <reportedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseId xsi:type="xsd:string" xsi:nil="true" /> 
  <resolvedInReleaseTitle xsi:type="xsd:string" xsi:nil="true" /> 
  <status xsi:type="xsd:string">RAD Reviewing</status> 
  <statusClass xsi:type="xsd:string">Open</statusClass> 
  <submittedByFullname xsi:type="xsd:string">Anon User</submittedByFullname> 
  <submittedByUsername xsi:type="xsd:string">anon_user</submittedByUsername> 
  <submittedDate xsi:type="xsd:dateTime">2013-01-31T10:27:13.000Z</submittedDate> 
  <title xsi:type="xsd:string">SWAPS Heatmap</title> 
  <trackerIcon xsi:type="xsd:string" xsi:nil="true" /> 
  <version xsi:type="xsd:int">100</version> 
  </multiRef>
  <multiRef id="id7" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:SoapFieldValues" xmlns:ns7="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <names soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <names xsi:type="xsd:string">BRD Received</names> 
  <names xsi:type="xsd:string">Dev Started</names> 
  <names xsi:type="xsd:string">EUDA Registered</names> 
  <names xsi:type="xsd:string">Prioritised   Pending Dev</names> 
  <names xsi:type="xsd:string">Product</names> 
  <names xsi:type="xsd:string">Product Group</names> 
  <names xsi:type="xsd:string">Requestor POC</names> 
  <names xsi:type="xsd:string">Signed Off</names> 
  <names xsi:type="xsd:string">UAT Delivered</names> 
  <names xsi:type="xsd:string">UAT Delivery Date</names> 
  <names xsi:type="xsd:string">VP Approval</names> 
  <names xsi:type="xsd:string">BMSC POC</names> 
  <names xsi:type="xsd:string">$fild306322$Coverage</names> 
  <names xsi:type="xsd:string">$fild306551$test</names> 
  </names>
  <types soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  </types>
  <values soapenc:arrayType="xsd:anyType[14]" xsi:type="soapenc:Array">
  <values xsi:type="xsd:dateTime">2013-01-30T08:00:00.000Z</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="soapenc:string">Synthetics</values> 
  <values xsi:type="soapenc:string">GPF</values> 
  <values xsi:type="soapenc:string" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:dateTime">2013-01-30T08:00:00.000Z</values> 
  <values xsi:type="soapenc:string">anon_user</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  </values>
  </multiRef>
  <multiRef id="id8" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns8:SoapFieldValues" xmlns:ns8="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <names soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <names xsi:type="xsd:string">BRD Received</names> 
  <names xsi:type="xsd:string">Dev Started</names> 
  <names xsi:type="xsd:string">EUDA Registered</names> 
  <names xsi:type="xsd:string">Prioritised   Pending Dev</names> 
  <names xsi:type="xsd:string">Product</names> 
  <names xsi:type="xsd:string">Product Group</names> 
  <names xsi:type="xsd:string">Requestor POC</names> 
  <names xsi:type="xsd:string">Signed Off</names> 
  <names xsi:type="xsd:string">UAT Delivered</names> 
  <names xsi:type="xsd:string">UAT Delivery Date</names> 
  <names xsi:type="xsd:string">VP Approval</names> 
  <names xsi:type="xsd:string">BMSC POC</names> 
  <names xsi:type="xsd:string">$fild306322$Coverage</names> 
  <names xsi:type="xsd:string">$fild306551$test</names> 
  </names>
  <types soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  </types>
  <values soapenc:arrayType="xsd:anyType[14]" xsi:type="soapenc:Array">
  <values xsi:type="xsd:dateTime">2013-01-31T08:00:00.000Z</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="soapenc:string">Synthetics</values> 
  <values xsi:type="soapenc:string">GPF</values> 
  <values xsi:type="soapenc:string" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:dateTime">2013-01-31T08:00:00.000Z</values> 
  <values xsi:type="soapenc:string">anon_user</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  </values>
  </multiRef>
  <multiRef id="id6" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns9:SoapFieldValues" xmlns:ns9="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <names soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <names xsi:type="xsd:string">BRD Received</names> 
  <names xsi:type="xsd:string">Dev Started</names> 
  <names xsi:type="xsd:string">EUDA Registered</names> 
  <names xsi:type="xsd:string">Prioritised   Pending Dev</names> 
  <names xsi:type="xsd:string">Product</names> 
  <names xsi:type="xsd:string">Product Group</names> 
  <names xsi:type="xsd:string">Requestor POC</names> 
  <names xsi:type="xsd:string">Signed Off</names> 
  <names xsi:type="xsd:string">UAT Delivered</names> 
  <names xsi:type="xsd:string">UAT Delivery Date</names> 
  <names xsi:type="xsd:string">VP Approval</names> 
  <names xsi:type="xsd:string">BMSC POC</names> 
  <names xsi:type="xsd:string">$fild306322$Coverage</names> 
  <names xsi:type="xsd:string">$fild306551$test</names> 
  </names>
  <types soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  </types>
  <values soapenc:arrayType="xsd:anyType[14]" xsi:type="soapenc:Array">
  <values xsi:type="xsd:dateTime">2013-02-01T08:00:00.000Z</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="soapenc:string">Synthetics</values> 
  <values xsi:type="soapenc:string">GPF</values> 
  <values xsi:type="soapenc:string" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:dateTime">2013-02-01T08:00:00.000Z</values> 
  <values xsi:type="soapenc:string">anon_user</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  </values>
  </multiRef>
  <multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns10:SoapFieldValues" xmlns:ns10="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <names soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <names xsi:type="xsd:string">BRD Received</names> 
  <names xsi:type="xsd:string">Dev Started</names> 
  <names xsi:type="xsd:string">EUDA Registered</names> 
  <names xsi:type="xsd:string">Prioritised   Pending Dev</names> 
  <names xsi:type="xsd:string">Product</names> 
  <names xsi:type="xsd:string">Product Group</names> 
  <names xsi:type="xsd:string">Requestor POC</names> 
  <names xsi:type="xsd:string">Signed Off</names> 
  <names xsi:type="xsd:string">UAT Delivered</names> 
  <names xsi:type="xsd:string">UAT Delivery Date</names> 
  <names xsi:type="xsd:string">VP Approval</names> 
  <names xsi:type="xsd:string">BMSC POC</names> 
  <names xsi:type="xsd:string">$fild306322$Coverage</names> 
  <names xsi:type="xsd:string">$fild306551$test</names> 
  </names>
  <types soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  </types>
  <values soapenc:arrayType="xsd:anyType[14]" xsi:type="soapenc:Array">
  <values xsi:type="xsd:dateTime">2013-02-01T08:00:00.000Z</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="soapenc:string">Synthetics</values> 
  <values xsi:type="soapenc:string">GPF</values> 
  <values xsi:type="soapenc:string" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:dateTime">2013-02-01T08:00:00.000Z</values> 
  <values xsi:type="soapenc:string">anon_user</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  </values>
  </multiRef>
  </soapenv:Body>
  </soapenv:Envelope>

これはすべて、TeamForge CollabNet サイトからの 4 つのレコードのみを表しています。

そんな「構造」が見えてきます。パスに/soapenv:Envelope/soapenv:Body/multiRef/dataRowsは、奇数形式の 4 つのレコードへの 4 つの参照が含まれています<dataRows href="#id1" />

次に、href id を使用して、次のようなパスに移動します。

/soapenv:Envelope/soapenv:Body/multiRef (where the id attribute matches the record)

このノードで、「assignedToFullname」、「title」などの要素をいくつか選択できるようにしたいと考えています。

ただし、このノード内には「flexFields」という要素があり、次のようになります。

<flexFields href="#id6" /> 

これは、CollabNet では多数のカスタム フィールドを使用できるためです。したがって、前と同じルールに従って、フレックスフィールド情報は次の場所にあります。

/soapenv:Envelope/soapenv:Body/multiRef (where the id attribute matches the flexfield href)

この XML の 1 つのレコードのスニペットは次のとおりです。

<multiRef id="id7" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:SoapFieldValues" xmlns:ns7="http://schema.open.collab.net/sfee50/soap60/type" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
  <names soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <names xsi:type="xsd:string">BRD Received</names> 
  <names xsi:type="xsd:string">Dev Started</names> 
  <names xsi:type="xsd:string">EUDA Registered</names> 
  <names xsi:type="xsd:string">Prioritised   Pending Dev</names> 
  <names xsi:type="xsd:string">Product</names> 
  <names xsi:type="xsd:string">Product Group</names> 
  <names xsi:type="xsd:string">Requestor POC</names> 
  <names xsi:type="xsd:string">Signed Off</names> 
  <names xsi:type="xsd:string">UAT Delivered</names> 
  <names xsi:type="xsd:string">UAT Delivery Date</names> 
  <names xsi:type="xsd:string">VP Approval</names> 
  <names xsi:type="xsd:string">BMSC POC</names> 
  <names xsi:type="xsd:string">$fild306322$Coverage</names> 
  <names xsi:type="xsd:string">$fild306551$test</names> 
  </names>
  <types soapenc:arrayType="xsd:string[14]" xsi:type="soapenc:Array">
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">String</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">Date</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  <types xsi:type="xsd:string">User</types> 
  </types>
  <values soapenc:arrayType="xsd:anyType[14]" xsi:type="soapenc:Array">
  <values xsi:type="xsd:dateTime">2013-01-30T08:00:00.000Z</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="soapenc:string">Synthetics</values> 
  <values xsi:type="soapenc:string">GPF</values> 
  <values xsi:type="soapenc:string" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:dateTime">2013-01-30T08:00:00.000Z</values> 
  <values xsi:type="soapenc:string">anon_user</values> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  <values xsi:type="xsd:anyType" xsi:nil="true" /> 
  </values>
  </multiRef>

SQL Server を使用して、指定された多数の要素を列として、さらにfledFields とその値を列として持つ 1 つのテーブルにこれを取得することは可能ですか?

これに関するヘルプは大歓迎です。

更新 OKこれまでのところ、次のようにXMLファイルから通常のデータを取得できました。

SELECT T.c.value('@id','varchar(5)') as [id]
    , T.c.value('title[1]','varchar(255)') as [Title]
    , T.c.value('id[1]','varchar(255)') as [Artifact]
    , T.c.value('priority[1]','varchar(255)') as [Priority]
    , T.c.value('assignedToFullname[1]','varchar(255)') as [Assignee]
    , T.c.value('status[1]','varchar(255)') as [Status]
    , T.c.value('statusClass[1]','varchar(255)') as [statusClass]
    , T.c.value('folderTitle[1]','varchar(255)') as [Tracker]
    , Replace(T.c.value('flexFields[1]/@href','varchar(255)'),'#','') as [flexFieldsID]
FROM @xml.nodes('declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/";
/soapenv:Envelope[1]/soapenv:Body[1]/multiRef') T(c)
WHERE T.c.value('@id','varchar(5)') IN
    (SELECT Replace(DR.h.value('@href','varchar(5)'),'#','') as [DataRowID]
    FROM @xml.nodes('declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/";
    /soapenv:Envelope[1]/soapenv:Body[1]/multiRef/dataRows/dataRows') DR(h))

しかし、これは恐ろしく見え、誰かがもっとエレガントな方法を知っているのではないかと思いました. この結果テーブルの最後に「flexFields」を追加する方法にもこだわっています。

さらなる更新 私はとても近いと思いますが、「名前」と「値」の間に構造的なリンクがないため、flexFields を「フラット」テーブルに取得する方法がわかりません。最初の Name は最初の Value のフィールド名です。これを行うためのクエリの書き方がわかりません。

4

1 に答える 1

0

SQL Server は、任意のテーブルまたは一時テーブルに挿入できる XML からデータを取得するための OPENXML メソッドを提供します。例:

    DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='
<ROOT>
<Customer CustomerID="VINET" ContactName="Paul Henriot">
   <Order CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:00:00">
      <OrderDetail OrderID="10248" ProductID="11" Quantity="12"/>
      <OrderDetail OrderID="10248" ProductID="42" Quantity="10"/>
   </Order>
</Customer>
<Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">
   <Order CustomerID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:00:00">
      <OrderDetail OrderID="10283" ProductID="72" Quantity="3"/>
   </Order>
</Customer>
</ROOT>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT    *
FROM       OPENXML (@idoc, '/ROOT/Customer',1)
            WITH (CustomerID  varchar(10),
                  ContactName varchar(20))

詳細については、次を参照してください: OPENXML

このアプローチで私が目にする唯一の問題は、サンプル XML に xml を読み取るためのエスケープ/無効な文字がたくさんあることです。このためには、XML からテーブルに値をフェッチできるように、REPLACE を使用して中間 PL/SQL の XML を有効な文字に置き換える必要があります。不完全な応答で申し訳ありません。現在、実際に機能するクエリを提供するために少し忙しいです。それが役に立てば幸い。

于 2013-02-04T12:15:11.577 に答える