Select 来自 xml 文件存储过程 运行 无限返回数千条重复记录

Select from xml file stored procedure running infinitely returning thousands of duplicate records

我有这个存储过程,我想 returns 由于错误的交叉应用,有很多重复的记录。看一下结果集的屏幕截图。案例编号 000110-54-3 只是己烷,但我得到与其他案例编号相关的其他化学名称也列出了相同的案例编号。因此,查询将永远运行其他 cross\outer 申请。任何帮助表示赞赏。

XML 文件目录项(有点大)

<ArrayOfCatalogItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <CatalogItem Version="1">
    <Container xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <ContainerSize>
        <Value>10.500000000</Value>
        <Units>OunceUS</Units>
      </ContainerSize>
      <ContainerType>Unknown</ContainerType>
      <MarkedForRetail xsi:nil="true" />
    </Container>
    <Documents CultureCode="en" Elink="https://3eonline.com/ImageServer/ImageViewer.aspx?id=3Q%2ffAR8ne%2fvPh6syVnSymkS%2bBDo8OjmbVocxRCMEgeENagNJzc81tOXY0yL87aEPfwnzvlaVmM1mbrA2r7BYXNzA43I%2baZTLYlibHjHcCDI%3d" Format="Msds" DocumentType="Sds" Country="USA" DocumentId="SDS8672822" RevisionDate="2015-05-18T00:00:00" xmlns="http://3ecompany.com/webservices/catalogitemxml" />
    <IsHazardous xmlns="http://3ecompany.com/webservices/catalogitemxml">true</IsHazardous>
    <ManufacturerName xmlns="http://3ecompany.com/webservices/catalogitemxml">Permatex Inc.</ManufacturerName>
    <Msds xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <Elink>https://3eonline.com/ImageServer/ImageViewer.aspx?id=3Q%2ffAR8ne%2fvPh6syVnSymqIuIP5CInA01ZbaRQ9r18GfjipRC2KgVeHKeJd2rplH4f%2b5u6E0coedMiZYmt%2fs1A%3d%3d</Elink>
      <FireCodeClassification>
        <Asphyxiant>false</Asphyxiant>
        <WaterReactive xsi:nil="true" />
        <Hmis Chronic="true" Fire="4" Health="2" Reactivity="0" Special="X" />
        <Nfpa Fire="4" Health="1" Reactivity="0" Special="" />
        <Sara>
          <Delayed>true</Delayed>
          <Fire>true</Fire>
          <Immediate>true</Immediate>
          <Pressure>true</Pressure>
          <Reactivity>false</Reactivity>
        </Sara>
        <DerivedPhysicalState>Aerosol</DerivedPhysicalState>
      </FireCodeClassification>
      <Ingredients>
        <ChemicalName>Hexane</ChemicalName>
        <Cas>000110-54-3</Cas>
        <Percent>30.000000</Percent>
        <PercentMin>10.000000</PercentMin>
        <PercentOperator>LessThanOrEqualTo</PercentOperator>
        <PercentMinOperator>GreaterThanOrEqualTo</PercentMinOperator>
        <PercentUnits>ByWeight</PercentUnits>
        <PercentModifier xsi:nil="true" />
        <MinPercent>10.000000</MinPercent>
        <MaxPercent>30.000000</MaxPercent>
        <Sara313Details>
          <ChemicalKey>110543</ChemicalKey>
          <Deminimus />
          <IsPBT>false</IsPBT>
          <IsSara313Toxic>true</IsSara313Toxic>
          <ReportingThreshold>
            <Value>25000</Value>
            <Units>Pound</Units>
          </ReportingThreshold>
          <SaraChemName>N-HEXANE</SaraChemName>
        </Sara313Details>
        <Sara302Details>
          <ChemicalKey>110543</ChemicalKey>
          <IsSara302Ehs>false</IsSara302Ehs>
        </Sara302Details>
        <OshaPelDetails>
          <ChemicalKey>110543</ChemicalKey>
          <OshaPelChemName>N-HEXANE</OshaPelChemName>
          <Type>Z1</Type>
          <Twa>500</Twa>
          <TwaUnits>unknown unit type</TwaUnits>
          <TwaInMg>1800</TwaInMg>
          <Stel xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <PeakInPpm xsi:nil="true" />
          <PeakInMg xsi:nil="true" />
        </OshaPelDetails>
        <AcgihTlvDetails>
          <ChemicalKey>110543</ChemicalKey>
          <AcgihTlvChemName>N-HEXANE</AcgihTlvChemName>
          <SkinDesignation>true</SkinDesignation>
          <Sensitizer>false</Sensitizer>
          <SimpleAsphyxiant>false</SimpleAsphyxiant>
          <CarcinogenCategory />
          <YearKnowCarcinogen />
          <ExposureByAllRoutes>false</ExposureByAllRoutes>
          <Twa xsi:nil="true" />
          <TwaInPpm>50</TwaInPpm>
          <StelInPpm xsi:nil="true" />
          <StelInMg xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <MolecularWeight>86.18</MolecularWeight>
          <TlvBasisCriticalEffect>CNS impair; peripheral neuropathy; eye irr</TlvBasisCriticalEffect>
        </AcgihTlvDetails>
        <AvgPercent>20.000000</AvgPercent>
      </Ingredients>
      <Ingredients>
        <ChemicalName>2-Propanone</ChemicalName>
        <Cas>000067-64-1</Cas>
        <Percent>30.000000</Percent>
        <PercentMin>10.000000</PercentMin>
        <PercentOperator>LessThanOrEqualTo</PercentOperator>
        <PercentMinOperator>GreaterThanOrEqualTo</PercentMinOperator>
        <PercentUnits>ByWeight</PercentUnits>
        <PercentModifier xsi:nil="true" />
        <MinPercent>10.000000</MinPercent>
        <MaxPercent>30.000000</MaxPercent>
        <Sara313Details>
          <ChemicalKey>67641</ChemicalKey>
          <IsPBT>false</IsPBT>
          <IsSara313Toxic>false</IsSara313Toxic>
        </Sara313Details>
        <Sara302Details>
          <ChemicalKey>67641</ChemicalKey>
          <IsSara302Ehs>false</IsSara302Ehs>
        </Sara302Details>
        <OshaPelDetails>
          <ChemicalKey>67641</ChemicalKey>
          <OshaPelChemName>ACETONE</OshaPelChemName>
          <Type>Z1</Type>
          <Twa>1000</Twa>
          <TwaUnits>unknown unit type</TwaUnits>
          <TwaInMg>2400</TwaInMg>
          <Stel xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <PeakInPpm xsi:nil="true" />
          <PeakInMg xsi:nil="true" />
        </OshaPelDetails>
        <AcgihTlvDetails>
          <ChemicalKey>67641</ChemicalKey>
          <AcgihTlvChemName>ACETONE</AcgihTlvChemName>
          <SkinDesignation>false</SkinDesignation>
          <Sensitizer>false</Sensitizer>
          <SimpleAsphyxiant>false</SimpleAsphyxiant>
          <CarcinogenCategory>A4</CarcinogenCategory>
          <YearKnowCarcinogen />
          <ExposureByAllRoutes>false</ExposureByAllRoutes>
          <Twa xsi:nil="true" />
          <TwaInPpm>250</TwaInPpm>
          <StelInPpm>500</StelInPpm>
          <StelInMg xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <MolecularWeight>58.05</MolecularWeight>
          <TlvBasisCriticalEffect>URT &amp; eye irr; CNS impair</TlvBasisCriticalEffect>
        </AcgihTlvDetails>
        <AvgPercent>20.000000</AvgPercent>
      </Ingredients>
      <MsdsId>8672822</MsdsId>
      <MsdsMfgName>Permatex USA</MsdsMfgName>
      <MsdsProductName>118Da All Purpose Spray Adhesive 11 oz</MsdsProductName>
      <Properties>
        <PhysicalState>Aerosol</PhysicalState>
        <BoilingPoint>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>38.0000</Value>
        </BoilingPoint>
        <FlashPoint>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>-18.0000</Value>
        </FlashPoint>
        <MolecularWeight xsi:nil="true" />
        <Ph xsi:nil="true" />
        <SpecificGravity>0.7300</SpecificGravity>
        <VaporDensity xsi:nil="true" />
        <Uel xsi:nil="true" />
        <Lel xsi:nil="true" />
        <BoilingPointInCelsius>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>38</Value>
        </BoilingPointInCelsius>
        <FlashPointInCelsius>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>-18</Value>
        </FlashPointInCelsius>
        <BoilingPointInFahrenheit>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Fahrenheit</Units>
          <Value>100.4</Value>
        </BoilingPointInFahrenheit>
        <FlashPointInFahrenheit>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Fahrenheit</Units>
          <Value>-0.399999999999999</Value>
        </FlashPointInFahrenheit>
      </Properties>
      <RevisionDate>2015-05-18T00:00:00</RevisionDate>
      <MsdsRevListId>3836824</MsdsRevListId>
      <SdsConfirmationDate>2015-05-18T00:00:00</SdsConfirmationDate>
      <ClassificationCompleted>true</ClassificationCompleted>
      <CasCompleted>true</CasCompleted>
      <PropertiesCompleted>true</PropertiesCompleted>
      <Locale>en</Locale>
      <DocumentFormat>Msds</DocumentFormat>
      <Country>USA</Country>
      <MsdsLanguage>en</MsdsLanguage>
      <MsdsRegion>UnitedStates</MsdsRegion>
      <SdsNotRequired>false</SdsNotRequired>
      <MfgContactInfo>
        <MfgAddress>6875 Parkland Boulevard</MfgAddress>
        <MfgCity>Solon</MfgCity>
        <MfgState>Ohio</MfgState>
        <MfgCountry>United States</MfgCountry>
        <MfgPostalCode>44139</MfgPostalCode>
        <MfgPhoneCountryCode />
        <MfgPhoneAreaCode>440</MfgPhoneAreaCode>
        <MfgPhoneNumber>914-3571</MfgPhoneNumber>
        <MfgPhoneExtension />
        <MfgFaxCountryCode />
        <MfgFaxAreaCode>440</MfgFaxAreaCode>
        <MfgFaxNumber>914-3500</MfgFaxNumber>
        <MfgFaxExtension />
        <MfgEmail>denise.boyd@permatex.com</MfgEmail>
        <MfgWebUrl>http://www.permatex.com</MfgWebUrl>
      </MfgContactInfo>
      <GhsClassification>
        <SignalWord>None</SignalWord>
        <SignalWordText>Danger</SignalWordText>
        <Pictograms>
          <Code>GHS02</Code>
        </Pictograms>
        <Pictograms>
          <Code>GHS07</Code>
        </Pictograms>
        <Pictograms>
          <Code>GHS08</Code>
        </Pictograms>
        <HazardClasses>
          <HazardClassText>Flammable aerosol.</HazardClassText>
          <CategoryText>Category 1</CategoryText>
          <HazardClassPhraseTextID>92876</HazardClassPhraseTextID>
          <CategoryPhraseTextID>93598</CategoryPhraseTextID>
          <InternalHazardClassPhraseID>4059</InternalHazardClassPhraseID>
          <InternalHazardClassPhraseLangCode>en</InternalHazardClassPhraseLangCode>
          <InternalCategoryPhraseID>4082</InternalCategoryPhraseID>
          <InternalCategoryPhraseLangCode>EN</InternalCategoryPhraseLangCode>
        </HazardClasses>
        <PCodes>
          <SequenceNumber>401</SequenceNumber>
          <Pcode>P405</Pcode>
          <PcodeText>Store locked up.</PcodeText>
          <PcodeSubTypeText>Storage</PcodeSubTypeText>
          <PcodePhraseTextID>91288</PcodePhraseTextID>
          <InternalPcodePhraseID>4009</InternalPcodePhraseID>
          <InternalPcodePhraseLangCode>EN</InternalPcodePhraseLangCode>
        </PCodes>
        <HCodes>
          <SequenceNumber>1</SequenceNumber>
          <Hcode>H315</Hcode>
          <HcodeText>Causes skin irritation.</HcodeText>
          <HcodeSubTypeText>HealthHazard</HcodeSubTypeText>
          <HcodePhraseTextID>91544</HcodePhraseTextID>
          <InternalHcodePhraseID>4017</InternalHcodePhraseID>
          <InternalHcodePhraseLangCode>EN</InternalHcodePhraseLangCode>
        <SignalWordPhraseTextID>236050</SignalWordPhraseTextID>
        <InternalSignalWordPhraseId>22738</InternalSignalWordPhraseId>
        <InternalSignalWordPhraseLangCode>EN</InternalSignalWordPhraseLangCode>
      </GhsClassification>
      <TransportationClassificationCompleted xsi:nil="true" />
      <WasteCompleted xsi:nil="true" />
      <ExtendedSds>false</ExtendedSds>
      <TransportationExceptionClassificationCompleted xsi:nil="true" />
      <BestAvailable>false</BestAvailable>
    </Msds>
    <ProductIdentifiers xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <Identifier>M007628</Identifier>
      <Source>CPN</Source>
      <FirstExportDate xsi:nil="true" />
      <LastExportDate xsi:nil="true" />
      <FlaggedForResend xsi:nil="true" />
    </ProductIdentifiers>
    <ProductName xmlns="http://3ecompany.com/webservices/catalogitemxml">118DA All Purpose Spray Adhesive - 82019 (10.5 oz aerosol)</ProductName>
    <ProductUid xmlns="http://3ecompany.com/webservices/catalogitemxml">2501f87679eb40c5bff24e9e84170ff1</ProductUid>
    <Locations xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <LocationUid>e504e4605e9c4da6a6243d617b45593f</LocationUid>
      <Name>LUS Philadelphia (New Inventory)</Name>
      <ChemicalApprovalStatus>None</ChemicalApprovalStatus>
      <Quantity xsi:nil="true" />
      <LocationPath>American Airlines &gt; PHL &gt; LUS Philadelphia (New Inventory)</LocationPath>
      <ChemicalApprovalConditionalNotes />
      <Notes />
      <ActivatedBy>tehrman</ActivatedBy>
      <ActivatedOn>2016-06-06T11:04:47.193</ActivatedOn>
    </Locations>
    <EeeProductId xmlns="http://3ecompany.com/webservices/catalogitemxml">3319854</EeeProductId>
    <EeeCpcId xmlns="http://3ecompany.com/webservices/catalogitemxml">15071137</EeeCpcId>
    <ConverterData xmlns="http://3ecompany.com/webservices/catalogitemxml" />
    <CreatedBy xmlns="http://3ecompany.com/webservices/catalogitemxml">ondata</CreatedBy>
    <CreatedDate xmlns="http://3ecompany.com/webservices/catalogitemxml">4/25/2016</CreatedDate>
    <IsDeactivated xmlns="http://3ecompany.com/webservices/catalogitemxml">false</IsDeactivated>
    <DeactivatedDate xsi:nil="true" xmlns="http://3ecompany.com/webservices/catalogitemxml" />
  </CatalogItem>
</ArrayOfCatalogItem>

从这个xml读取的存储过程returns很多重复

这是一个粗略的存储过程草稿,我知道我可以进一步缩短它,但我会在弄清楚其他所有内容后再做。

BEGIN

DECLARE @XmlTable TABLE (XMLDATA XML)

INSERT INTO @XmlTable(XMLData)
SELECT CONVERT(XML, BulkColumn) AS BulkColumn 
FROM OPENROWSET(BULK 'C:\AA.Sample.File.LUS.Pilly-oneCI.xml', SINGLE_BLOB) AS x;

;WITH XMLNAMESPACES ('http://3ecompany.com/webservices/catalogitemxml' as CI)
SELECT 
    --CIVersion = CI.value('@Version', 'int'),
    Identifier = PID.value('(.)[1]', 'varchar(9)'),
    Product_Name = MSDSPN.value('(.)[1]','varchar(100)'),
    Revision_Date = RevDt.value('(.)[1]', 'Datetime'),
    Review_Date = RevwDt.value('(.)[1]', 'Datetime'),
    Density = Dy.value('(.)[1]', 'float'),
    Specific_Gravity = SG.value('(.)[1]', 'float'),
    Manufacturer_Name = MN.value('(.)[1]', 'varchar(80)'),
    Manufacturer_Address = Mad.value('(.)[1]', 'varchar(80)'),
    Manufacturer_City = MCY.value('(.)[1]', 'varchar(40)'),
    Manufacturer_State = MST.value('(.)[1]', 'varchar(20)'),
    Manufacturer_Postal_Code = MPC.value('(.)[1]', 'varchar(20)'),
    CAS_Number = CAS.value('(.)[1]', 'varchar(20)'),
    Chemical_Name = CN.value('(.)[1]', 'varchar(100)'),
    Weight_Percent = PC.value('(.)[1]', 'varchar(50)'),
    Min_Weight_Percent = MNPC.value('(.)[1]', 'float'),
    Max_Weight_Percent = MXPC.value('(.)[1]', 'float'),
    Container_Size = CSV.value('(.)[1]', 'float'),
    Container_Unit = CSU.value('(.)[1]', 'varchar(30)'),
    SARA_Fire = SF.value('(.)[1]', 'bit'),
    SARA_Release = SR.value('(.)[1]', 'bit'),
    SARA_Reactivity = SRY.value('(.)[1]', 'bit'),
    SARA_Acute = SRA.value('(.)[1]', 'bit'),
    SARA_Chronic = SRC.value('(.)[1]', 'bit'),
    EHS = SDV.value('(.)[1]', 'bit'),
   -- TPQ_Pounds = if(SRTX.value('(.)[1]','bit')) return SDV.value('(.)[1]', 'int')) else (return 0),
    Solid = PS.exist('(.)[contains(.,"Solid")]'),
    Liquid = PS.exist('(.)[contains(.,"Liquid")]'),
    Gas = PS.exist('(.)[contains(.,"Gas")]'),
    Container_Code = CTP.value('(.)[1]', 'varchar(10)')

FROM
    @XmlTable
Outer APPLY
    XMLData.nodes('/ArrayOfCatalogItem/CatalogItem') AS XT(CI)
OUTER APPLY
    CI.nodes('CI:ProductIdentifiers/CI:Identifier') AS XT2(PID)
OUTER APPLY
    CI.nodes('CI:Msds/CI:MsdsProductName') AS XT3(MSDSPN)
OUTER APPLY
    CI.nodes('CI:Msds/CI:RevisionDate') AS XT4(RevDt)
OUTER APPLY
    CI.nodes('CI:Msds/CI:SdsConfirmationDate') AS XT5(RevwDt)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Properties/CI:Density/CI:Value') AS XT6(Dy)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Properties/CI:SpecificGravity') AS XT7(SG)
OUTER APPLY
    CI.nodes('CI:ManufacturerName') AS XT13(Mn)
OUTER APPLY
    CI.nodes('CI:Msds/CI:MfgContactInfo/CI:MfgAddress') AS XT14(Mad)
OUTER APPLY
    CI.nodes('CI:Msds/CI:MfgContactInfo/CI:MfgCity') AS XT15(MCY)
OUTER APPLY
    CI.nodes('CI:Msds/CI:MfgContactInfo/CI:MfgState') AS XT16(MST)
OUTER APPLY
    CI.nodes('CI:Msds/CI:MfgContactInfo/CI:MfgPostalCode') AS XT17(MPC)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:Cas') AS XT18(CAS)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:ChemicalName') AS XT19(CN)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:Percent') AS XT20(PC)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:MinPercent') AS XT21(MNPC)
OUTER APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:MaxPercent') AS XT22(MXPC)
OUTER APPLY
    CI.nodes('CI:Msds/CI:FireCodeClassification/CI:Sara/CI:Fire') AS XT8(SF)
OUTER APPLY
    CI.nodes('CI:Container/CI:ContainerSize/CI:Value') AS XT25(CSV)
OUTER APPLY
    CI.nodes('CI:Container/CI:ContainerSize/CI:Units') AS XT26(CSU)
OUTER APPLY
    CI.nodes('CI:Msds/CI:FireCodeClassification/CI:Sara/CI:Pressure') AS XT9(SR)
OUTER APPLY
    CI.nodes('CI:Msds/CI:FireCodeClassification/CI:Sara/CI:Reactivity') AS XT10(SRY)
OUTER APPLY
    CI.nodes('CI:Msds/CI:FireCodeClassification/CI:Sara/CI:Immediate') AS XT11(SRA)
OUTER APPLY
    CI.nodes('CI:Msds/CI:FireCodeClassification/CI:Sara/CI:Delayed') AS XT12(SRC)
CROSS APPLY
    CI.nodes('CI:Msds/CI:Ingredients/CI:Sara313Details/CI:IsSara313Toxic') AS XT23(SRTX)
OUTER APPLY
        CI.nodes('CI:Msds/CI:Ingredients/CI:Sara313Details/CI:ReportingThreshold/CI:Value') AS XT24(SDV)
CROSS APPLY
    CI.nodes('CI:Msds/CI:Properties/CI:PhysicalState') AS XT27(PS)
OUTER APPLY
    CI.nodes('CI:Container/CI:ContainerType') AS XT28(CTP)

END

在你的尝试中有很多APPLYs。仅在嵌套 1:n 的情况下 才需要它们!

您的大部分嵌套 绑定 1:1。您只需使用更长的 XPath.

即可读取这些值

顺便说一句:您的 XML 中缺少结尾 </HCodes>

你的XML

DECLARE @xml XML=
'<ArrayOfCatalogItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <CatalogItem Version="1">
    <Container xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <ContainerSize>
        <Value>10.500000000</Value>
        <Units>OunceUS</Units>
      </ContainerSize>
      <ContainerType>Unknown</ContainerType>
      <MarkedForRetail xsi:nil="true" />
    </Container>
    <Documents CultureCode="en" Elink="https://3eonline.com/ImageServer/ImageViewer.aspx?id=3Q%2ffAR8ne%2fvPh6syVnSymkS%2bBDo8OjmbVocxRCMEgeENagNJzc81tOXY0yL87aEPfwnzvlaVmM1mbrA2r7BYXNzA43I%2baZTLYlibHjHcCDI%3d" Format="Msds" DocumentType="Sds" Country="USA" DocumentId="SDS8672822" RevisionDate="2015-05-18T00:00:00" xmlns="http://3ecompany.com/webservices/catalogitemxml" />
    <IsHazardous xmlns="http://3ecompany.com/webservices/catalogitemxml">true</IsHazardous>
    <ManufacturerName xmlns="http://3ecompany.com/webservices/catalogitemxml">Permatex Inc.</ManufacturerName>
    <Msds xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <Elink>https://3eonline.com/ImageServer/ImageViewer.aspx?id=3Q%2ffAR8ne%2fvPh6syVnSymqIuIP5CInA01ZbaRQ9r18GfjipRC2KgVeHKeJd2rplH4f%2b5u6E0coedMiZYmt%2fs1A%3d%3d</Elink>
      <FireCodeClassification>
        <Asphyxiant>false</Asphyxiant>
        <WaterReactive xsi:nil="true" />
        <Hmis Chronic="true" Fire="4" Health="2" Reactivity="0" Special="X" />
        <Nfpa Fire="4" Health="1" Reactivity="0" Special="" />
        <Sara>
          <Delayed>true</Delayed>
          <Fire>true</Fire>
          <Immediate>true</Immediate>
          <Pressure>true</Pressure>
          <Reactivity>false</Reactivity>
        </Sara>
        <DerivedPhysicalState>Aerosol</DerivedPhysicalState>
      </FireCodeClassification>
      <Ingredients>
        <ChemicalName>Hexane</ChemicalName>
        <Cas>000110-54-3</Cas>
        <Percent>30.000000</Percent>
        <PercentMin>10.000000</PercentMin>
        <PercentOperator>LessThanOrEqualTo</PercentOperator>
        <PercentMinOperator>GreaterThanOrEqualTo</PercentMinOperator>
        <PercentUnits>ByWeight</PercentUnits>
        <PercentModifier xsi:nil="true" />
        <MinPercent>10.000000</MinPercent>
        <MaxPercent>30.000000</MaxPercent>
        <Sara313Details>
          <ChemicalKey>110543</ChemicalKey>
          <Deminimus />
          <IsPBT>false</IsPBT>
          <IsSara313Toxic>true</IsSara313Toxic>
          <ReportingThreshold>
            <Value>25000</Value>
            <Units>Pound</Units>
          </ReportingThreshold>
          <SaraChemName>N-HEXANE</SaraChemName>
        </Sara313Details>
        <Sara302Details>
          <ChemicalKey>110543</ChemicalKey>
          <IsSara302Ehs>false</IsSara302Ehs>
        </Sara302Details>
        <OshaPelDetails>
          <ChemicalKey>110543</ChemicalKey>
          <OshaPelChemName>N-HEXANE</OshaPelChemName>
          <Type>Z1</Type>
          <Twa>500</Twa>
          <TwaUnits>unknown unit type</TwaUnits>
          <TwaInMg>1800</TwaInMg>
          <Stel xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <PeakInPpm xsi:nil="true" />
          <PeakInMg xsi:nil="true" />
        </OshaPelDetails>
        <AcgihTlvDetails>
          <ChemicalKey>110543</ChemicalKey>
          <AcgihTlvChemName>N-HEXANE</AcgihTlvChemName>
          <SkinDesignation>true</SkinDesignation>
          <Sensitizer>false</Sensitizer>
          <SimpleAsphyxiant>false</SimpleAsphyxiant>
          <CarcinogenCategory />
          <YearKnowCarcinogen />
          <ExposureByAllRoutes>false</ExposureByAllRoutes>
          <Twa xsi:nil="true" />
          <TwaInPpm>50</TwaInPpm>
          <StelInPpm xsi:nil="true" />
          <StelInMg xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <MolecularWeight>86.18</MolecularWeight>
          <TlvBasisCriticalEffect>CNS impair; peripheral neuropathy; eye irr</TlvBasisCriticalEffect>
        </AcgihTlvDetails>
        <AvgPercent>20.000000</AvgPercent>
      </Ingredients>
      <Ingredients>
        <ChemicalName>2-Propanone</ChemicalName>
        <Cas>000067-64-1</Cas>
        <Percent>30.000000</Percent>
        <PercentMin>10.000000</PercentMin>
        <PercentOperator>LessThanOrEqualTo</PercentOperator>
        <PercentMinOperator>GreaterThanOrEqualTo</PercentMinOperator>
        <PercentUnits>ByWeight</PercentUnits>
        <PercentModifier xsi:nil="true" />
        <MinPercent>10.000000</MinPercent>
        <MaxPercent>30.000000</MaxPercent>
        <Sara313Details>
          <ChemicalKey>67641</ChemicalKey>
          <IsPBT>false</IsPBT>
          <IsSara313Toxic>false</IsSara313Toxic>
        </Sara313Details>
        <Sara302Details>
          <ChemicalKey>67641</ChemicalKey>
          <IsSara302Ehs>false</IsSara302Ehs>
        </Sara302Details>
        <OshaPelDetails>
          <ChemicalKey>67641</ChemicalKey>
          <OshaPelChemName>ACETONE</OshaPelChemName>
          <Type>Z1</Type>
          <Twa>1000</Twa>
          <TwaUnits>unknown unit type</TwaUnits>
          <TwaInMg>2400</TwaInMg>
          <Stel xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <PeakInPpm xsi:nil="true" />
          <PeakInMg xsi:nil="true" />
        </OshaPelDetails>
        <AcgihTlvDetails>
          <ChemicalKey>67641</ChemicalKey>
          <AcgihTlvChemName>ACETONE</AcgihTlvChemName>
          <SkinDesignation>false</SkinDesignation>
          <Sensitizer>false</Sensitizer>
          <SimpleAsphyxiant>false</SimpleAsphyxiant>
          <CarcinogenCategory>A4</CarcinogenCategory>
          <YearKnowCarcinogen />
          <ExposureByAllRoutes>false</ExposureByAllRoutes>
          <Twa xsi:nil="true" />
          <TwaInPpm>250</TwaInPpm>
          <StelInPpm>500</StelInPpm>
          <StelInMg xsi:nil="true" />
          <CeilInPpm xsi:nil="true" />
          <CeilInMg xsi:nil="true" />
          <MolecularWeight>58.05</MolecularWeight>
          <TlvBasisCriticalEffect>URT &amp; eye irr; CNS impair</TlvBasisCriticalEffect>
        </AcgihTlvDetails>
        <AvgPercent>20.000000</AvgPercent>
      </Ingredients>
      <MsdsId>8672822</MsdsId>
      <MsdsMfgName>Permatex USA</MsdsMfgName>
      <MsdsProductName>118Da All Purpose Spray Adhesive 11 oz</MsdsProductName>
      <Properties>
        <PhysicalState>Aerosol</PhysicalState>
        <BoilingPoint>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>38.0000</Value>
        </BoilingPoint>
        <FlashPoint>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>-18.0000</Value>
        </FlashPoint>
        <MolecularWeight xsi:nil="true" />
        <Ph xsi:nil="true" />
        <SpecificGravity>0.7300</SpecificGravity>
        <VaporDensity xsi:nil="true" />
        <Uel xsi:nil="true" />
        <Lel xsi:nil="true" />
        <BoilingPointInCelsius>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>38</Value>
        </BoilingPointInCelsius>
        <FlashPointInCelsius>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Celsius</Units>
          <Value>-18</Value>
        </FlashPointInCelsius>
        <BoilingPointInFahrenheit>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Fahrenheit</Units>
          <Value>100.4</Value>
        </BoilingPointInFahrenheit>
        <FlashPointInFahrenheit>
          <Minimum xsi:nil="true" />
          <Range>EqualTo</Range>
          <Units>Fahrenheit</Units>
          <Value>-0.399999999999999</Value>
        </FlashPointInFahrenheit>
      </Properties>
      <RevisionDate>2015-05-18T00:00:00</RevisionDate>
      <MsdsRevListId>3836824</MsdsRevListId>
      <SdsConfirmationDate>2015-05-18T00:00:00</SdsConfirmationDate>
      <ClassificationCompleted>true</ClassificationCompleted>
      <CasCompleted>true</CasCompleted>
      <PropertiesCompleted>true</PropertiesCompleted>
      <Locale>en</Locale>
      <DocumentFormat>Msds</DocumentFormat>
      <Country>USA</Country>
      <MsdsLanguage>en</MsdsLanguage>
      <MsdsRegion>UnitedStates</MsdsRegion>
      <SdsNotRequired>false</SdsNotRequired>
      <MfgContactInfo>
        <MfgAddress>6875 Parkland Boulevard</MfgAddress>
        <MfgCity>Solon</MfgCity>
        <MfgState>Ohio</MfgState>
        <MfgCountry>United States</MfgCountry>
        <MfgPostalCode>44139</MfgPostalCode>
        <MfgPhoneCountryCode />
        <MfgPhoneAreaCode>440</MfgPhoneAreaCode>
        <MfgPhoneNumber>914-3571</MfgPhoneNumber>
        <MfgPhoneExtension />
        <MfgFaxCountryCode />
        <MfgFaxAreaCode>440</MfgFaxAreaCode>
        <MfgFaxNumber>914-3500</MfgFaxNumber>
        <MfgFaxExtension />
        <MfgEmail>denise.boyd@permatex.com</MfgEmail>
        <MfgWebUrl>http://www.permatex.com</MfgWebUrl>
      </MfgContactInfo>
      <GhsClassification>
        <SignalWord>None</SignalWord>
        <SignalWordText>Danger</SignalWordText>
        <Pictograms>
          <Code>GHS02</Code>
        </Pictograms>
        <Pictograms>
          <Code>GHS07</Code>
        </Pictograms>
        <Pictograms>
          <Code>GHS08</Code>
        </Pictograms>
        <HazardClasses>
          <HazardClassText>Flammable aerosol.</HazardClassText>
          <CategoryText>Category 1</CategoryText>
          <HazardClassPhraseTextID>92876</HazardClassPhraseTextID>
          <CategoryPhraseTextID>93598</CategoryPhraseTextID>
          <InternalHazardClassPhraseID>4059</InternalHazardClassPhraseID>
          <InternalHazardClassPhraseLangCode>en</InternalHazardClassPhraseLangCode>
          <InternalCategoryPhraseID>4082</InternalCategoryPhraseID>
          <InternalCategoryPhraseLangCode>EN</InternalCategoryPhraseLangCode>
        </HazardClasses>
        <PCodes>
          <SequenceNumber>401</SequenceNumber>
          <Pcode>P405</Pcode>
          <PcodeText>Store locked up.</PcodeText>
          <PcodeSubTypeText>Storage</PcodeSubTypeText>
          <PcodePhraseTextID>91288</PcodePhraseTextID>
          <InternalPcodePhraseID>4009</InternalPcodePhraseID>
          <InternalPcodePhraseLangCode>EN</InternalPcodePhraseLangCode>
        </PCodes>
        <HCodes>
          <SequenceNumber>1</SequenceNumber>
          <Hcode>H315</Hcode>
          <HcodeText>Causes skin irritation.</HcodeText>
          <HcodeSubTypeText>HealthHazard</HcodeSubTypeText>
          <HcodePhraseTextID>91544</HcodePhraseTextID>
          <InternalHcodePhraseID>4017</InternalHcodePhraseID>
          <InternalHcodePhraseLangCode>EN</InternalHcodePhraseLangCode>
        </HCodes>
        <SignalWordPhraseTextID>236050</SignalWordPhraseTextID>
        <InternalSignalWordPhraseId>22738</InternalSignalWordPhraseId>
        <InternalSignalWordPhraseLangCode>EN</InternalSignalWordPhraseLangCode>
      </GhsClassification>
      <TransportationClassificationCompleted xsi:nil="true" />
      <WasteCompleted xsi:nil="true" />
      <ExtendedSds>false</ExtendedSds>
      <TransportationExceptionClassificationCompleted xsi:nil="true" />
      <BestAvailable>false</BestAvailable>
    </Msds>
    <ProductIdentifiers xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <Identifier>M007628</Identifier>
      <Source>CPN</Source>
      <FirstExportDate xsi:nil="true" />
      <LastExportDate xsi:nil="true" />
      <FlaggedForResend xsi:nil="true" />
    </ProductIdentifiers>
    <ProductName xmlns="http://3ecompany.com/webservices/catalogitemxml">118DA All Purpose Spray Adhesive - 82019 (10.5 oz aerosol)</ProductName>
    <ProductUid xmlns="http://3ecompany.com/webservices/catalogitemxml">2501f87679eb40c5bff24e9e84170ff1</ProductUid>
    <Locations xmlns="http://3ecompany.com/webservices/catalogitemxml">
      <LocationUid>e504e4605e9c4da6a6243d617b45593f</LocationUid>
      <Name>LUS Philadelphia (New Inventory)</Name>
      <ChemicalApprovalStatus>None</ChemicalApprovalStatus>
      <Quantity xsi:nil="true" />
      <LocationPath>American Airlines &gt; PHL &gt; LUS Philadelphia (New Inventory)</LocationPath>
      <ChemicalApprovalConditionalNotes />
      <Notes />
      <ActivatedBy>tehrman</ActivatedBy>
      <ActivatedOn>2016-06-06T11:04:47.193</ActivatedOn>
    </Locations>
    <EeeProductId xmlns="http://3ecompany.com/webservices/catalogitemxml">3319854</EeeProductId>
    <EeeCpcId xmlns="http://3ecompany.com/webservices/catalogitemxml">15071137</EeeCpcId>
    <ConverterData xmlns="http://3ecompany.com/webservices/catalogitemxml" />
    <CreatedBy xmlns="http://3ecompany.com/webservices/catalogitemxml">ondata</CreatedBy>
    <CreatedDate xmlns="http://3ecompany.com/webservices/catalogitemxml">4/25/2016</CreatedDate>
    <IsDeactivated xmlns="http://3ecompany.com/webservices/catalogitemxml">false</IsDeactivated>
    <DeactivatedDate xsi:nil="true" xmlns="http://3ecompany.com/webservices/catalogitemxml" />
  </CatalogItem>
</ArrayOfCatalogItem>';

这是查询

WITH XMLNAMESPACES('http://3ecompany.com/webservices/catalogitemxml' AS i --Default on inner levels...
                  ,'http://www.w3.org/2001/XMLSchema' AS xsd
                  ,'http://www.w3.org/2001/XMLSchema-instance' AS xsi)
SELECT ci.value('@Version','int') AS CatalogVersion
      ,ci.value('(i:Container/i:ContainerSize/i:Value)[1]','decimal(15,9)') AS ContainerSizeValue
      ,ci.value('(i:Container/i:ContainerType)[1]','varchar(max)') AS ContainerType
      --more values from Container-node
      ,ci.value('(i:Documents/@CultureCode)[1]','varchar(10)') AS DocumentCultureCode
      --more attributes from Documents
      --more elements on the same level
      ,ci.value('(i:Msds/i:Elink)[1]','varchar(max)') AS Msds_Elink
      ,ci.value('(i:Msds/i:FireCodeClassification/i:Asphyxiant)[1]','bit') AS Msds_FireCodeClassification_Asphyxiant
      --more elements here
      ,ig.value('(i:ChemicalName)[1]','varchar(max)') AS Ingredients_ChemicalName
      --more values for ingredients here
      ,ci.value('(i:Msds/i:MsdsId)[1]','bigint') AS Msds_Id
      --more elements here

      --and many more following this approach

FROM @xml.nodes('/ArrayOfCatalogItem/CatalogItem') AS A(ci)
CROSS APPLY A.ci.nodes('i:Msds/i:Ingredients') AS B(ig)