0

我在 SQL 中有以下代码,它返回 FromDate 和 OrgName 上的正确值。问题在于 indvlPK 返回 NULL。谢谢

DECLARE @XmlDocumentHandle int  
DECLARE @XmlDocument nvarchar(4000)  
SET @XmlDocument = N'<ROOT>  
        <Indvl>
      <Info lastNm="Dobbins" firstNm="William" midNm="Makay" indvlPK="7147798" actvAGReg="Y" link="https://adviserinfo.sec.gov/individual/summary/7147798"/>
      <OthrNms>
        <OthrNm lastNm="Dobbins" firstNm="Makay"/>
        <OthrNm lastNm="Dobbins" firstNm="William"/>
      </OthrNms>
      <CrntEmps>
        <CrntEmp orgNm="CUSO FINANCIAL SERVICES, L.P." orgPK="42132" str1="10150 MEANLEY DRIVE, 1ST FLOOR" city="SAN DIEGO" state="CA" cntry="United States" postlCd="92131">
          <CrntRgstns>
            <CrntRgstn regAuth="UT" regCat="RA" st="APPROVED" stDt="2020-01-30"/>
          </CrntRgstns>
          <BrnchOfLocs>
            <BrnchOfLoc str1="2722 E Red Cliff Drive" city="St George" state="UT" cntry="United States" postlCd="84790"/>
            <BrnchOfLoc str1="590 West Mesquite Blvd" city="Mesquite" state="NV" cntry="United States" postlCd="89024"/>
            <BrnchOfLoc str1="1564 West Sunset Blvd" city="St George" state="UT" cntry="United States" postlCd="84770"/>
          </BrnchOfLocs>
        </CrntEmp>
      </CrntEmps>
      <Exms>
        <Exm exmCd="S66" exmNm="Uniform Combined State Law Examination" exmDt="2019-10-24"/>
      </Exms>
      <Dsgntns/>
      <PrevRgstns/>
      <EmpHss>
        <EmpHs fromDt="06/2019" orgNm="CUSO Financial Services, LP" city="San Diego" state="CA"/>
        <EmpHs fromDt="01/2019" toDt="06/2019" orgNm="Umemployed" city="St George" state="UT"/>
        <EmpHs fromDt="09/2018" toDt="01/2019" orgNm="Soltis Investment Advisors" city="St George" state="UT"/>
        <EmpHs fromDt="12/2016" toDt="09/2018" orgNm="America First Credit Union" city="St George" state="UT"/>
        <EmpHs fromDt="03/2015" toDt="12/2016" orgNm="America First Credit Union" city="St George" state="UT"/>
        <EmpHs fromDt="08/2014" toDt="03/2015" orgNm="Under Armour" city="Lehi" state="UT"/>
        <EmpHs fromDt="03/2014" toDt="08/2014" orgNm="California Pizza Kitchen" city="Orem" state="UT"/>
        <EmpHs fromDt="06/2009" toDt="03/2014" orgNm="Full-time Education" city="Herriman" state="UT"/>
      </EmpHss>
      <OthrBuss/>
      <DRPs/>
    </Indvl>  
</ROOT>'  
EXEC sp_xml_preparedocument @XmlDocumentHandle OUTPUT, @XmlDocument  
SELECT *  FROM OPENXML (@XmlDocumentHandle, '/ROOT/Indvl/EmpHss/EmpHs')  
WITH (indvlPK  varchar(50) '/ROOT/Indvl/Info/@indvlPK',  
      FromDate      varchar(50) '@fromDt',  
      OrgName         varchar(50) '@orgNm')  
EXEC sp_xml_removedocument @XmlDocumentHandle

请你能告诉我如何返回indvlPK吗?

谢谢

4

0 回答 0