• OPENXML用法


    DECLARE @idoc int
    DECLARE @doc varchar(8000)
    SET @doc ='<ROOT>
    	<MaerskXML>
    		<MaerskInfo value="CFS">
    			<ShippingOrderREF>REF-123</ShippingOrderREF>
    			<DamcoSONumber>SGH1234567</DamcoSONumber>
    		</MaerskInfo>
    		<MaerskInfo value="CFQ">
    			<ShippingOrderREF>REF-124</ShippingOrderREF>
    			<DamcoSONumber>SGH1234568</DamcoSONumber>
    		</MaerskInfo>
    		<ACTION>ACKNOWLEDGEC</ACTION>
    		<opDate>2011-04-12</opDate>
    	</MaerskXML>
    	<MaerskXML>
    		<MaerskInfo value="CFT">
    			<ShippingOrderREF>REF-128</ShippingOrderREF>
    			<DamcoSONumber>SGH1234577</DamcoSONumber>
    		</MaerskInfo>
    		<MaerskInfo value="CFU">
    			<ShippingOrderREF>REF-129</ShippingOrderREF>
    			<DamcoSONumber>SGH1234578</DamcoSONumber>
    		</MaerskInfo>
    		<ACTION>ACKNOWLEDGEF</ACTION>
    		<opDate>2011-04-18</opDate>
    	</MaerskXML>
    </ROOT>'
    
    EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
    
    SELECT *FROM   OPENXML (@idoc, '/ROOT/MaerskXML/MaerskInfo')WITH (
    value varchar(20) '@value',
    ShippingOrderREF varchar(20) 'ShippingOrderREF',
    DamcoSONumber varchar(20) 'DamcoSONumber',
    [ACTION] varchar(20) '../ACTION',
    opDate varchar(20) '../opDate')
    EXEC sp_xml_removedocument @idoc
    
    千人.NET交流群:18362376,因为有你,代码变得更简单,加群请输入cnblogs
  • 相关阅读:
    USB
    Google
    机型参数
    mac
    反编译
    xcode
    Ios 消息推送
    真机:特殊
    Android
    object-c
  • 原文地址:https://www.cnblogs.com/kingkoo/p/2026572.html
Copyright © 2020-2023  润新知