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